首页 > 解决方案 > 如何在 react-native-pell-rich-editor 中隐藏键盘而不失去焦点?

问题描述

我想隐藏键盘以选择表情符号,但键盘没有隐藏在 react-native-pell-rich-editor 中,因为当我使用 blurContentEditor() 方法隐藏键盘时,我会失去焦点,并且无法在输入框中添加表情符号。那么有什么方法可以隐藏键盘。

Keyboard.dismiss 在这里不起作用。

因为它会导致表情符号选择器和键盘都打开。

这是屏幕截图。

在此处输入图像描述

 <RichEditor
                    ref={rf => this.richText = rf}
                    initialContentHTML={this.state.PostDescription}
                    editorInitializedCallback={()=>{
               this.richText.focusContentEditor()

                    }}
                    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-nativereact-native-androidreact-native-ios

解决方案


该道具showSoftInputOnFocus={false}在组件上以这种方式工作TextInput,请尝试在您的组件上使用它。


推荐阅读