【问题标题】:React-native-gifted-chat change color under inputToolbar在 inputToolbar 下 React-native-gifted-chat 改变颜色
【发布时间】:2021-02-27 05:47:43
【问题描述】:

我正在使用 react-native-gifted-chat,我很难弄清楚如何在 InputToolbar 下方着色或添加一个类似于下面第二张图片的视图。

这就是我所拥有的

这就是我想要做的事情

如果有人知道我如何接近第二张图片,那就太好了。如果有人可以发送指向类似示例的链接或任何帮助,我们将不胜感激。

【问题讨论】:

    标签: react-native user-interface react-native-gifted-chat


    【解决方案1】:

    您可以使用renderInputToolbar 并设置根视图的高度,只要它填充到底部即可:

    import {LeftAction, ChatInput, SendButton} from 'react-native-gifted-chat'
    
    ...
    
    minInputToolbarHeight={70}
    renderInputToolbar={(props)=> (
        <View style={{ backgroundColor: COLORS.lighterblue, height: 200 }}>
            <View style={styles.inputContainer}>
                <LeftAction {...props} />
                <ChatInput {...props} />
                <SendButton {...props} />
            </View>
            <View></View>
        </View>
    )}
    

    结果:

    【讨论】:

    • 虽然此链接可能会回答问题(示例链接),但最好在此处包含答案的基本部分并提供链接以供参考。如果链接页面发生更改,仅链接的答案可能会失效。
    • 这正是我为完成这项工作所做的。我赞成这不是为什么有人会反对正确的答案。感谢 Hieu 的回答。