Search code examples
react-nativereact-native-ios

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


I'm in need of hide the keyboard when the user submit or press the enter/next key of the keyboard. Here's the code i'm using to the 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%'
    }}
/>

Solution

  • Using this code as example, you can make the RichEditor blur using:

    this.richText.blurContentEditor();
    

    But, there's no OnSubmit function (Or at least i dont found it on my search), as it's just a webview of react-native-webview and not a TextInput.

    You can use react-native-webview-quilljs as they have ON_KEY_PRESS event and get the Enter key press.