react-native-gifted-chat
react-native-gifted-chat copied to clipboard
Error [mobx] Out of bounds read: 5 when using mobx
Hello! Im using GiftedChat 2.4.0 with mobx:
The component renders chat:
return (
<GiftedChat
messages={chatStore.messages}
renderBubble={renderBubble}
onSend={(messages: any) => onSend(messages)}
user={{
_id: 1,
}}
/>
);
Chat store:
export class ConsultationsStore {
constructor() {
makeAutoObservable(this);
}
messages: any[] = [];
addMessage = (message: string, sender: string) => {
const chatMessage = {
_id: Math.round(Math.random() * 100000000),
text: message,
createdAt: new Date(),
user: {
_id: 1,
name: sender
}
}
this.messages.unshift(chatMessage);
}
}
When receiving messages from webrtc and adding them through addMessages, the messages are added normally. But there's an error [mobx] Out of bounds read