在回车键/下一个键上隐藏键盘,并带有反应丰富的本机编辑器

问题描述 投票:1回答:1

当用户提交或按下键盘的Enter / Next键时,我需要隐藏键盘。这是我用于RichEditor TextInput的代码。

<RichEditor
    ref={rf => this.richText = rf}
    initialContentHTML={this.state.PostDescription}
    style={{
      // minHeight:Platform.OS === 'ios' ? 30 : 40,
      // maxHeight:Platform.OS === 'ios' ? 100: 40,
      height:'100%',
      backgroundColor:'white',
      flex: 1,justifyContent:'center',
      minWidth:'100%',width:'100%'
    }}
/>
react-native react-native-android react-native-ios
1个回答
0
投票

this代码为例,您可以使用以下方法使RichEditor模糊:

this.richText.blurContentEditor();

但是,没有OnSubmit函数(或者至少我没有在搜索中找到它),因为它只是webviewreact-native-webview,而不是TextInput。

您可以使用react-native-webview-quilljs,因为它们具有ON_KEY_PRESS事件并按下Enter键。

© www.soinside.com 2019 - 2024. All rights reserved.