簡體   English   中英

React Native Gifted Chat:如何隱藏鍵盤和文本輸入

[英]React Native Gifted Chat: How to hide keyboard and text input

我正在使用 expo 制作一個反應原生應用程序,並正在使用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 }}
/>

minInputToolbarHeight屬性設置為零:

<GiftedChat
    ...
    minInputToolbarHeight=0
/>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM