react-native - 在 react native 天才聊天中,哪些道具用于在工具栏中添加图像和相机等额外功能?我如何实现它?
问题描述
我是新来的反应原生天才聊天。我尝试在聊天工具栏中添加相机、图库等功能。我通读了道具。我认为它要么是renderInputToolbar 要么是renderComposer。但是该网站没有任何关于如何使用其道具的描述。它只是说明什么是 for 以及您可以通过什么类型。
有人可以解释一下如何使用这些道具吗?非常感谢!
解决方案
我添加了带有发送按钮的相机按钮,如下所示:
<GiftedChat
...
textInputStyle={styles.composer}
minComposerHeight={40}
minInputToolbarHeight={60}
renderSend={(props) => (
<View style={{ flexDirection: 'row', alignItems: 'center', height: 60 }}>
<BtnRound icon="camera" iconColor={Colors.primaryBlue} size={40} style={{ marginHorizontal: 5 }} onPress={() => this.choosePicture()} />
<Send {...props}>
<View style={styles.btnSend}>
<Icon name="ios-send" size={24} color="#ffffff" />
</View>
</Send>
</View>
)}
...
/>
风格
composer:{
borderRadius: 25,
borderWidth: 0.5,
borderColor: '#dddddd',
marginTop: 10,
marginBottom: 10,
paddingLeft: 10,
paddingTop: 5,
paddingBottom: 5,
paddingRight: 10,
fontSize: 16
},
btnSend: {
height: 40,
width: 40,
alignItems: 'center',
justifyContent: 'center',
marginRight: 10,
backgroundColor: Colors.primary,
...getShadow(),
borderRadius: 50
}
BtnRound
是一个简单的自定义TouchableOpacity
按钮,它使用提供的图标呈现圆形按钮。BtnRound 代码在这里。
推荐阅读
- git - 您的分支和 'origin/integration/phone_number_change' 已经分道扬镳
- encryption - TLS 1.2 密码套件错误,Schannel 事件 ID 36874 和 36888
- excel - Excel。1 个特定列的特殊数字分隔符格式,整个文档没有
- r - R rowSums() 正在生成一个奇怪的输出。我究竟做错了什么?
- amazon-web-services - 为什么我无法在 Tableau Server 上刷新我的雪花数据提取?
- sql-server - 查询保留最新的非零值
- api - 有没有一种方法可以让 Binance API 市场购买订单本身决定最大可购买数量并且我不必计算它?
- excel - 从一个工作簿复制/粘贴到另一个工作簿
- sql-server - 如何使用“Stuff and 'For Xml Path'”来合并表格中的行
- c - Playing with pointer in c language