react-native-material-kit icon indicating copy to clipboard operation
react-native-material-kit copied to clipboard

MKTextField error in onBlur

Open oun opened this issue 7 years ago • 1 comments

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(''); }

oun avatar Mar 31 '17 10:03 oun

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} />

stevula avatar Apr 24 '18 21:04 stevula