Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes crash with: Tried to get frame for out of range index -1 [scrollToBottom (scrollToEnd of list with inverted option) only if messages available/loaded] #2358

Closed
wants to merge 1 commit into from

Conversation

fahad86
Copy link

@fahad86 fahad86 commented Mar 16, 2023

Without this fix we end-up having
Tried to get frame for out of range index -1 error thrown from the underlying FlatList

This is currently causing a lot of crashes on Production for us. The crashes happen when we try to navigate to the chat window directly from push notifications

@fahad86 fahad86 changed the title scrollToBottom (scrollToEnd of list with inverted option) only if messages available/loaded FIX error: Tried to get frame for out of range index -1 - scrollToBottom (scrollToEnd of list with inverted option) only if messages available/loaded Mar 17, 2023
@fahad86 fahad86 changed the title FIX error: Tried to get frame for out of range index -1 - scrollToBottom (scrollToEnd of list with inverted option) only if messages available/loaded Fixes crash with: Tried to get frame for out of range index -1 [scrollToBottom (scrollToEnd of list with inverted option) only if messages available/loaded] Mar 17, 2023
@manuhook
Copy link

manuhook commented May 2, 2023

@fahad86 maybe i'm missing something but i have this error when i'm trying to build :
src/GiftedChat.tsx:666:25 - error TS2339: Property 'data' does not exist on type 'Readonly<GiftedChatProps<TMessage>> & Readonly<{ children?: ReactNode; }>'.

@fahad86
Copy link
Author

fahad86 commented May 3, 2023

@fahad86 maybe i'm missing something but i have this error when i'm trying to build : src/GiftedChat.tsx:666:25 - error TS2339: Property 'data' does not exist on type 'Readonly<GiftedChatProps<TMessage>> & Readonly<{ children?: ReactNode; }>'.

I guess the problem you mentioned would happen when there are no properties added to the tag?

Let me add some null checks.

src/GiftedChat.tsx Outdated Show resolved Hide resolved
@Johan-dutoit
Copy link
Collaborator

👋 @fahad86 please resolve the conflicts, will merge in after.

@fahad86
Copy link
Author

fahad86 commented May 4, 2023

👋 @fahad86 please resolve the conflicts, will merge in after.

Done.

src/GiftedChat.tsx Outdated Show resolved Hide resolved
@fahad86 fahad86 closed this May 8, 2023
@fahad86
Copy link
Author

fahad86 commented May 8, 2023

@Johan-dutoit saw that there was one more conflict which I've resolved now

@fahad86 fahad86 reopened this May 8, 2023
@fahad86 fahad86 closed this May 16, 2023
@manuhook
Copy link

Hi @fahad86 ! we have also this issue, it will not be merged ?

@fahad86
Copy link
Author

fahad86 commented May 16, 2023

Hi @fahad86 ! we have also this issue, it will not be merged ?

I think with the refactoring for the latest version, empty messages handling has already been implemented in a different place. This PR should however still be valid for versions < 2.1.0

@manuhook
Copy link

I've just checked, i'm still having the issue in prod with react-native-gifted-chat 2.1.0
"Invariant Violation Tried to get frame for out of range index -1"

@manuhook
Copy link

manuhook commented Jun 2, 2023

Problem was linked to react-native. Fixed in RN 0.72
facebook/react-native#36850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants