使用 react-native-pell-rich-editor 在 enter/next 按下时隐藏键盘

Hide keyboard on enter/next press with react-native-pell-rich-editor

我需要在用户提交或按下键盘的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%'
    }}
/>

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

this.richText.blurContentEditor();

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

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