From e2ae87284594ff7ea94f7c03c05b324b9c6975ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Tue, 2 Apr 2019 19:27:38 +0200 Subject: [PATCH] [Consignment] Check if optional functions exist. --- .../Consignments/Components/TextInput.tsx | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lib/Components/Consignments/Components/TextInput.tsx b/src/lib/Components/Consignments/Components/TextInput.tsx index 49ab140be5..f108bd80e8 100644 --- a/src/lib/Components/Consignments/Components/TextInput.tsx +++ b/src/lib/Components/Consignments/Components/TextInput.tsx @@ -73,8 +73,18 @@ export default class TextInputField extends React.Component this.setState({ focused: true }, () => this.props.text.onFocus(e))} - onBlur={e => this.setState({ focused: false }, () => this.props.text.onBlur(e))} + onFocus={e => + this.setState( + { focused: true }, + () => this.props.text && this.props.text.onFocus && this.props.text.onFocus(e) + ) + } + onBlur={e => + this.setState( + { focused: false }, + () => this.props.text && this.props.text.onBlur && this.props.text.onBlur(e) + ) + } /> )}