【发布时间】:2021-01-26 04:23:26
【问题描述】:
我想在我的 react-native-gifted-chat 中添加语言环境,因为聊天不会一个接一个地显示出来,我猜是因为时区。
我将语言环境添加到我的天才聊天中:
import en from 'dayjs/locale/en'
render() {
return (
<View style={{backgroundColor: '#000000', flex: 1}}>
<GiftedChat
showUserAvatar={true}
isTyping={this.state.isTyping}
renderUsernameOnMessage={true}
messages={this.state.messages}
onSend={message => this.onSend(message)}
scrollToBottom
locale = { en } <-----------------------------
showAvatarForEveryMessage = {false}
showUserAvatar= {true}
dateFormat = 'll'
timeFormat = 'LT'
placeholder = "Talk to people..."
onPressAvatar={user => this.getProfile(user)}
/>
</View>
)
但现在我得到了错误:
TypeError: undefined is not an object (evaluating 'n[M].replace')
这是因为我使用了错误的导入类型,还是现有聊天存在问题,我是否需要删除它们才能正常工作?
【问题讨论】:
标签: javascript react-native react-native-gifted-chat