[英]React Native Gifted Chat: How to hide keyboard and text input
I am making a react native application using expo and am using react-native-gifted-chat
for a chat like feature ( https://github.com/FaridSafi/react-native-gifted-chat ).我正在使用 expo 制作一个反应原生应用程序,并正在使用react-native-gifted-chat
进行类似聊天的功能( https://github.com/FaridSafi/react-native-gifted-chat )。 In this feature, I only want certain users to be able to send a message.在此功能中,我只希望某些用户能够发送消息。 The users who cant should only be able to view the messages that have been sent.不能的用户应该只能查看已发送的消息。
In order to implement this, I need a way to hide the keyboard/text input for the users who are not authorized to send a message.为了实现这一点,我需要一种方法来为无权发送消息的用户隐藏键盘/文本输入。 I was reading through the documentation and am unsure of how to do this.我正在阅读文档,但不确定如何执行此操作。 Is there a way to hide the keyboard/text input and only load the messages?有没有办法隐藏键盘/文本输入并只加载消息?
Not sure if this is relevant but my code for the gifted chat is as follows:不确定这是否相关,但我的天才聊天代码如下:
<GiftedChat
messages={this.state.messages}
placeholder="Send your thoughts?"
onSend={(messages) => this.sendMessage(messages)}
user={{
...user details
}}
/>
Thanks!谢谢!
Just pass null
for the prop renderInputToolbar
:只需将null
传递给道具renderInputToolbar
:
<GiftedChat
...
renderInputToolbar={() => { return null }}
/>
Set the minInputToolbarHeight
attribute to zero:将minInputToolbarHeight
属性设置为零:
<GiftedChat
...
minInputToolbarHeight=0
/>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.