当用户提交或按下键盘的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
函数(或者至少我没有在搜索中找到它),因为它只是webview
的react-native-webview,而不是TextInput。
您可以使用react-native-webview-quilljs,因为它们具有ON_KEY_PRESS
事件并按下Enter键。