I have the following TextInput Component:
<TextInput value={this.state.inputText}
maxLength={1}
onSubmitEditing={this.textHandler}
onChangeText={(text) => this.setState({inputText: text})} />
When I change the input to '' and submit it (in the TextInput) I have the following error: "Failed prop type: Invalid prop 'value' of type 'object' supplied to 'TextInput'"
I tried deleting each callback and apparently, the error is throwed because of the 'onSubmitEditing'.
textHandler = (text) => {
if(text == '' || text == '-' ){
text = '0';
}
this.setState({inputText: text});
}
How can I make the callback to be called only where text is a string and not an object?