react-native - 如何在 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%'
解决方案
该道具showSoftInputOnFocus={false}
在组件上以这种方式工作TextInput
,请尝试在您的组件上使用它。
推荐阅读
- regex - 在 Google DataStudio 中使用 CASE 语句 REGEXP_MATCH 字符串中的多个单词
- sql - 如何计算 PIVOT 中的百分比
- database-design - 学生管理工具的数据库设计
- laravel - 从具有父关系条件的子项中选择唯一记录
- r - 如何在直方图中再插入一列并将其绘制在 Y 轴上
- flask - time.sleep 阻止烧瓶请求
- notifications - X 时间延迟后批准拉取请求待处理通知
- python - 我的代码正在运行但没有输出,这是什么问题?
- excel - 循环n->x,扫描col f是否存在,写入col a。总是应用程序或对象错误
- wpf - WPF:当他的上下文 id 更改时,我应该如何更改按钮的样式?