react-native - React Native Gifted Chat:如何隐藏键盘和文本输入
问题描述
我正在使用 expo 制作一个 react native 应用程序,并且正在使用react-native-gifted-chat
类似聊天的功能(https://github.com/FaridSafi/react-native-gifted-chat)。在此功能中,我只希望某些用户能够发送消息。不能的用户应该只能查看已发送的消息。
为了实现这一点,我需要一种方法来为无权发送消息的用户隐藏键盘/文本输入。我正在阅读文档,但不确定如何执行此操作。有没有办法隐藏键盘/文本输入并只加载消息?
不确定这是否相关,但我的天才聊天代码如下:
<GiftedChat
messages={this.state.messages}
placeholder="Send your thoughts?"
onSend={(messages) => this.sendMessage(messages)}
user={{
...user details
}}
/>
谢谢!
解决方案
只需传递null
道具renderInputToolbar
:
<GiftedChat
...
renderInputToolbar={() => { return null }}
/>
推荐阅读
- css - 如何准确打印页面在屏幕上的外观?
- excel - 如何使用 vba 匹配列并计算匹配项
- javascript - 如何减少ant design在元素之间应用的默认边距/填充
- javascript - Mongoose updateMany 文档包含特定的 Array 元素
- c++ - 如何使用 Eigen 求解具有 Neumann 型边界条件的方程组?
- python - 具有数组数据类型的 z3 建模图
- python - 和运营商的不一致
- django - 如何在 Django 中执行数据库中的代码
- javascript - 如何将图像从反应原生应用程序(Expo)上传到 django 服务器
- javascript - Flask/Python - 如何使用运行进度更新进度条