FaridSafi / react-native-gifted-chat

💬 The most complete chat UI for React Native
https://gifted.chat
MIT License
13.53k stars 3.55k forks source link

Tried to get frame for out of range index -1 #2360

Open fahad86 opened 1 year ago

fahad86 commented 1 year ago

Issue Description

Crash with error:

when empty messages ([]) and inverted is set to true. This happens because internally gifted chat tries to scrollToBottom when inverted={true} even when there is no data.

Steps to Reproduce / Code Snippets

<SafeAreaView>
  <Chat messages={[]} inverted={true} />
</SafeAreaView>

Expected Results

Not to scrollToBottom or crash with error Tried to get frame for out of range index -1

Additional Information

fahad86 commented 1 year ago

PR #2358 submitted

fahad86 commented 1 year ago

Screenshot_1678963066