react-native - 警告:失败的道具类型:提供给“ParsedText”的无效道具.style键“0”
问题描述
当我使用 react-native-gifted-chat 在我的 react-native 应用程序中发送消息时,我收到有关 ParsedText 的警告(react-native-parsed-text -> https://github.com/taskrabbit/react-native -解析文本)
这是我得到的警告:
Warning: Failed prop type: Invalid props.style key '0' supplied to
'ParsedText'.
Bad object: {
"0": {
"color":"white",
"textDecorationLine":"underline"
},
"1": {
"color":"darkturquoise"
},
"color":"#A4A4A4"
}
你有过这个问题吗?
这是反应本机代码:
renderMessageText(messageTextProps) {
return (
<MessageText
{...messageTextProps}
linkStyle={{
left: { color: 'darkturquoise' },
right: { color: 'darkturquoise' }
}}
/>
);
}
<GiftedChat
messages={this.state.messages}
onSend={this.onSend}
user={user}
showUserAvatar={true}
renderUsernameOnMessage={true}
showAvatarForEveryMessage={true}
renderMessageText={this.renderMessageText}
parsePatterns={(linkStyle) => [
{ pattern: /#(\w+)/, style: { ...linkStyle, color: '#A4A4A4' }, onPress: this.onPressHashtag }
]}
/>
解决方案
推荐阅读
- javascript - 在带有回调的单独函数中获取 AWS getSignedUrl 函数的返回值
- spring - 不使用 spring batch + spring boot + sql server 应用程序运行 DDL 脚本
- gatsby - Gatsby childImageSharp 分辨率设置
- python - pandas:如何在 pandas 中绘制电影数量与 IMDB 电影类型的饼图?
- c++ - 包含 Windows 标头时难以解决循环依赖问题
- python - 高效的时间增量计算器
- php - 使用 php 将 HTML 表导出到 Excel(无 MYSQL)
- c++ - 将 Log 宏转换为目标 C 字符串
- jquery - jQuery UI Slider 重叠滑动条
- android - 在 Android Studio 中运行程序时模拟器无法打开