React Native - 天才聊天消息问题

时间:2021-05-27 13:15:48

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

我正在使用 react-native-gifted-chat 版本“^0.16.3”,但每次收到新消息时,它只会更新最后 2 条消息。我该怎么做才能更新新消息的完整聊天列表,这是正确的做法吗?

<View style={{
                    backgroundColor: 'white',
                    padding: 10,
                    width: "85%",
                    borderRadius: 5,
                    shadowColor: '#000',
                    shadowOffset: { width: 0, height: 0 },
                    shadowOpacity: 0.4,
                    shadowRadius: 1,
                    elevation: 5
                }}>
                    {/* <Text color={'black'} bold size={'4.4%'} style={{ paddingLeft: 10 }} >Client wants to hire you</Text> */}
                    <Bubble
                        {...item}
                        allowFontScaling={false}
                        wrapperStyle={{
                            right: {
                                backgroundColor: Theme.darkSkyBlue,
                                width:'100%'
                            },
                            left: {
                                backgroundColor: Theme.white,
                                width:'100%'
                            }
                        }}
                    />
                    { !answered && type === "button" && (
                        <Row style={{width:'100%'}}>
                            <Btn style={{width:'48%'}} onPress={() => requestOpportunities(State.TrainerHire, requestId, _id)} yes>
                                <Btn.Text allowFontScaling = {false}>YES</Btn.Text>
                            </Btn>
                            <Btn style={{width:'48%'}} activeOpacity={0.3} onPress={() => requestOpportunities(State.TrainerAccept, requestId, _id)} packages>
                                <Btn.Text color={'blue'} allowFontScaling = {false}>NO</Btn.Text>
                            </Btn>
                        </Row>
                    )}
                </View>

这是我的代码,当用户点击是或否按钮时,它应该隐藏这些按钮。它在最后一条消息时工作,但如果在此消息之后还有一些消息,则它不起作用。

0 个答案:

没有答案
相关问题