React-native-gifted-chat: Problem with isLoadingEarlier in LoadEarlier

Created on 30 Mar 2019  路  11Comments  路  Source: FaridSafi/react-native-gifted-chat

Issue Description

I used the example and the don't work, look the video below:

https://github.com/FaridSafi/react-native-gifted-chat/tree/master/example

Steps to Reproduce / Code Snippets

ScreenRecording_033020190735

Expected Results

Show loading

Additional Information

  • Nodejs version: v8.11.3
  • React version: 16.0.0-alpha.12
  • React Native version: 0.46.3
  • react-native-gifted-chat version: 0.7.2
  • Platform(s) (iOS, Android, or both?): both
wontfix

Most helpful comment

or add this property to Component
See There is prop in GiftedChat that also can solve this.
isLoadingEarlier={this.state.isLoadingEarlier} onLoadEarlier={() => this.getMoreMessages()} extraData={this.state}

All 11 comments

Same issue here. I'm passing true to isLoadingEarlier, while waiting for response from backend, and then pass false, when i get the response. But ActivityIndicator isn't showing

Same issue here. If I set "isLoadingEarlier" initially to true, I actually see the ActivityIndicator but it won't show up when I change the state

+1

Any updates on this?

+1, please fix it

+1

when we change isLoadingEarlier in a state we also have to change the message too like

this.setState(previousState => ({ messages: GiftedChat.prepend(previousState.messages, []), isLoadingEarlier: true, }));

or add this property to Component
See There is prop in GiftedChat that also can solve this.
isLoadingEarlier={this.state.isLoadingEarlier} onLoadEarlier={() => this.getMoreMessages()} extraData={this.state}

or add this property to Component
See There is prop in GiftedChat that also can solve this.
isLoadingEarlier={this.state.isLoadingEarlier} onLoadEarlier={() => this.getMoreMessages()} extraData={this.state}

This is working! The only way I could explain it to myself (without looking to the source code) is that GiftedChat watches for the change in extraData, but doesn't listen to "our" state changes.
If we link our state to their extraData, updating state will trigger the update of the GiftedChat component.
So, just add extraData={this.state} to your <GiftedChat ... /> and it will work :)
This still needs to be fixed, though..

Also, don't forget to set loadEarlier={true}, because the ActivityIndicator (i.e. the loader) appears only if button for loading earlier messages is visible. 馃槃

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fr33maan picture Fr33maan  路  3Comments

redwind picture redwind  路  3Comments

luisfuertes picture luisfuertes  路  3Comments

arayaryoma picture arayaryoma  路  3Comments

yazhengwang picture yazhengwang  路  3Comments