Repository navigation
[iOS] Flatlist bug: update refreshing prop programmatically #25898
Copy link
Copy link
Closed
Labels
BugComponent: FlatListPlatform: iOSiOS applications.iOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
When changing the "refreshing" property programmatically on iOS, the activity indicator doesn't show automatically, the user needs to move the list a little bit down in order to see the activity indicator spinning.
It works perfectly fine on Android.
React Native version:
System:
OS: macOS 10.14.6
CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
Memory: 38.77 MB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 8.16.0 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.10.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
Android SDK:
API Levels: 28
Build Tools: 28.0.3
System Images: android-28 | Google APIs Intel x86 Atom_64
IDEs:
Android Studio: 3.4 AI-183.6156.11.34.5692245
Xcode: 10.3/10G8 - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.4 => 0.60.4
npmGlobalPackages:
react-native-cli: 2.0.1
react-native-rename: 2.4.1
Steps To Reproduce
- Render a FlatList with some content and a refreshing property
- Programmatically set refreshing property to true
Describe what you expected to happen:
By updating the refreshing property programmatically, the list should automatically display the activity indicator.
Snack, code example, screenshot, or link to a repository:
render() {
const {
onPressJob,
loading,
jobs,
onRefresh,
onEndReached,
} = this.props;
return (
<FlatList
data={ jobs }
refreshing={ loading }
onRefresh={ onRefresh }
onEndReached={ onEndReached }
keyExtractor={ item => (item.Id) }
renderItem={ ({ item, index }) => (
<Grid container>
<Grid
item
size={ 6 }
spacingTop={ index === 0 ? 12 : 6 }
spacingBottom={ index === (jobs.length - 1) ? 12 : 6 }
>
<JobAvailableCard
item={ item }
onPress={ onPressJob }
/>
</Grid>
</Grid>
) }
/>
);
}
Reacted by Giorgio Balduzzi, Adam Wagner, Alex Vargas, Fonov Sergei, davesimtech, Daehoon Kim, Saran Tanpituckpong ✔️, kennyliu, Piotr Górecki, Taylor Johnson and 1 more
Metadata
Metadata
Assignees
Labels
BugComponent: FlatListPlatform: iOSiOS applications.iOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Activity
paul-paliychuk commentedon Aug 13, 2019
Also having this issue
elkinjosetm commentedon Aug 13, 2019
I'm still having this issue, I haven't been able to dig deeper.
salmanLee commentedon Aug 17, 2019
still at 0.60
elkinjosetm commentedon Aug 20, 2019
Still happening at 0.60.5
elkinjosetm commentedon Aug 26, 2019
Has anybody found a solution for this issue?
elkinjosetm commentedon Sep 30, 2019
Still happening on 0.61.1
elkinjosetm commentedon Oct 15, 2019
Still happening on 0.61.2
elkinjosetm commentedon Oct 15, 2019
Has anybody found a solution for this problem?
Gektor0508 commentedon Oct 23, 2019
Hi, I am on version 0.59.10 and the following around worked for me.
Not sure if it would work on the latest react-native version. But you could give it a try :)
danieloprado commentedon Oct 28, 2019
Workaround: The first render refreshing prop should be false.
ragamufin commentedon Nov 14, 2019
It seems like I've had to come up with some clugy workaround for this issue on iOS every couple of react-native releases and here I am again. None of the solutions above worked for me. You can set the
contentInset={{ top: this.state.refreshing ? -60 : 0 }}on the FlatList and this works but there is no animation when the refresh control is hides.The workaround that works for me is to (again, this is for iOS as android works fine out of the box):
Add the
scrollToOverflowEnabledprop to the FlatList.When the event to refresh fires call the following on a ref to the FlatList before setting
refreshingto true:ghsdh3409 commentedon Nov 26, 2019
This issue could be resolved on this PR #27236).
i1990jain commentedon Dec 18, 2019
In the case of a FlatList this issue still persists on iOS. Works perfectly on android when using the refreshing and onRefresh props in this way.
stale commentedon Mar 17, 2020
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.
stale commentedon Mar 24, 2020
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.