react-native-material-kit
react-native-material-kit copied to clipboard
MKTextField error in onBlur
Hi,
I found this error in iOS.
Fatal Exception: RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'e.refs.floatingLabel.updateText')
I use textfield with floating label in redux-form. The scenario is when I make the textfield focus and then tap back to previous screen, the onBlur is called but the floatingLabel is already undefined. The line number 484 is causing the error:
// and hide floating label
// FIXME workaround https://github.com/facebook/react-native/issues/3220
if (!this.bufferedValue) {
this.refs.floatingLabel.updateText('');
}
I was also encountering this problem. Instead of setting floatingLabelEnabled={true}
I changed it to be true only if the field has a value:
<MKTextField floatingLabelEnabled={!!this.props.value} />