react-native-gifted-chat icon indicating copy to clipboard operation
react-native-gifted-chat copied to clipboard

Error [mobx] Out of bounds read: 5 when using mobx

Open muramidaza opened this issue 1 year ago • 0 comments

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

muramidaza avatar Dec 20 '23 12:12 muramidaza