react-native: FlatList data changed but refresh indicator not shows automatically
Is this a bug report?
when my flatList data changed, the layout changed but refresh indicator on top of flatList is not always shows loading automatically, I have to pull it down a little bit then the indicator stick on flatList, or it just shows at a blink when the data really changed, not shows at whole async data changed time as expected.
Have you read the Contributing Guidelines?
yes
Environment
react-native -v
: 0.46.0node -v
: v6.9.1npm -v
: 3.10.8yarn --version
: 0.24.5
-
Target Platform: iOS android works fine
-
Development Operating System: macOS
-
Build tools: Xcode
Steps to Reproduce
- set refreshing state to true then call api, but refresh indicator on flatList not always automatically pull down
- api back then data changed, it pull down at a blink, set refreshing state to false
Expected Behavior
loading indicator should show right after api called.
Actual Behavior
it shows and disappear quickly on data changed.
onRefresh = async () => {
this.setState({
isRefreshing: true
});
await this.props.searchProducts(this.state.searchString);
await this.setState({
data: this.props.products.searchProductsIds.map(
id => this.props.products.searchProductsById[id]
)
});
this.setState({
isRefreshing: false
});
};
<FlatList
removeClippedSubviews={false}
onRefresh={this.onRefresh}
refreshing={this.state.refreshing}
extraData={this.extraData}
data={this.state.data}
renderItem={this.renderItem}
keyExtractor={product => product.id}
contentContainerStyle={styles.listContainer}
onEndReached={this.handleLoadMore}
onEndReachedThreshold={5}
/>
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 28
- Comments: 31 (1 by maintainers)
FlatList and SectionList is bad performance. Try this,please. may be it is a surprise for you
https://github.com/bolan9999/react-native-largelist
Just pass onRefresh props. If you’re not using onRefresh, just pass
onRefresh={ () => null }
. refreshing props will now work.Still happening in RN 0.55.4…When i switch the tab in my app, and set refreshing to FlatList, the refresh indicator not show. but it can show by pull to refresh. (This problem only appears on iOS)
I temporarily solved the problem with the following code:
Solved it, by setting
flex: 1
styles to the root container before the FlatListTry setting data:[] in your onRefresh function, when you set isRefreshing: true. That worked for me.
is still happening 😕
Same issue in RN 0.52.0.
FlatList not scrolls to show the indicator when it contains more items than can be displayed on the screen.
I have this issue (0.53.0).
I have a button that calls the refresh handler and It works fine, showing the refreshControl indicator. The problem is the case when I first pull manually the FlatList to refresh (which also it is doing ok) and then I press that button. The refreshControl indicator is never shown again using that button.
So … can anybody reopen this issue?
Can anybody confirm that this is fixed in 0.54.x ?
@V1sk
Your workaround is good. But it causes another problem.
Every time when the app launch, let say the first rendering, when you click the button, and the flatlist pull down more disance than expected. After then, pull down works fine.
Have any idea?
Thanks for posting this! It looks like you may not be using the latest version of React Native, v0.53.0, released on January 2018. Can you make sure this issue can still be reproduced in the latest version?
I am going to close this, but please feel free to open a new issue if you are able to confirm that this is still a problem in v0.53.0 or newer.
How to Contribute • What to Expect from Maintainers