首次点击时会在Keyboard上调用KeyboardDidHide函数,以响应IOS中的本机TextInput

时间:2019-01-10 06:19:52

标签: react-native

我的代码如下

componentWillMount() {
    this.keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', this._keyboardDidHide);
}

componentWillUnmount() {
    this.keyboardDidHideListener.remove();
}

_keyboardDidHide() {
    Keyboard.dismiss();
}

<TextInput
        placeholder="text 1"
        onChangeText={(text) => { this.setState({ text1:text }) }}
        underlineColorAndroid='transparent'
        value={this.state.text1} />

它在android中工作正常,但在IOS中会出现问题。我的TextInput不会专注于第一次轻按。突然键盘关闭,我的输入失去了焦点。请帮我。任何帮助将不胜感激。

0 个答案:

没有答案