react-native: RefreshControl refresh indicator is not shown on iOS
Description
The refresh indicator for <RefreshControl /> is not shown in<ScrollView> and related components like <VirtualizedList /> and <FlatList /> etc… when refreshing is initially set as true (i.e. refreshing={true}).
This happens in both, when using Expo Go and when using the build iOS app.
Version
0.69.7, 0.70.6
Output of npx react-native info
System: OS: Linux 5.15 Gentoo Linux CPU: (12) x64 Intel® Core™ i9-8950HK CPU @ 2.90GHz Memory: 16.15 GB / 62.44 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.17.0 - ~/.config/nvm/versions/node/v16.17.0/bin/node Yarn: 1.22.19 - ~/workspace/fgs/mobile/node_modules/.bin/yarn npm: 2.15.12 - ~/workspace/fgs/mobile/node_modules/.bin/npm Watchman: Not Found SDKs: Android SDK: Not Found IDEs: Android Studio: Not Found Languages: Java: 11.0.15 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.0.0 => 18.0.0 react-native: 0.69.6 => 0.69.6 npmGlobalPackages: react-native: Not Found
Steps to reproduce
<ScrollView
contentContainerStyle={styles.scrollView}
refreshControl={
<RefreshControl
refreshing={true}
onRefresh={onRefresh}
/>
}
>
<Text>
This refresh indicator is not shown on iOS
</Text>
</ScrollView>
Snack, code example, screenshot, or link to a repository
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 18
- Comments: 29
Commits related to this issue
- Fix iOS GeneralPostList spinner hidden on initial fetch - Not present on Android - Not present for any subsequent tabs - Not present when manually pulling-to-refresh - Others are facing this in https... — committed to High5Apps/organize-rn by High5Apps 3 years ago
- Fix iOS GeneralPostList spinner hidden on initial fetch - Not present on Android - Not present for any subsequent tabs - Not present when manually pulling-to-refresh - Others are facing this in https... — committed to High5Apps/organize-rn by High5Apps 3 years ago
This issue has been reported before (and sometimes incorrectly closed): #24855 & #37308 & #36173 & #24530 Some of those issues are related to a
FlatList, while this story is related to aScrollView.For us this is still reproducible:
<small>Please upvote the issue 👍to get more attention.</small>
I am also having this issue, the RefreshControl will not show when initially set to true. It will only show on pull to refresh
@rochajulian yes, you can update to 0.79 and it will fix the issue without any additional efforts. The only problem with update is that expo is not compatible with RN 0.79 yet. Edit: Expo 53 is in beta and it uses RN 0.79, so that problem wouldn’t last long
I’m also having this issue. To resolve I’m setting refreshing boolean after 10 mills
I have implemented a workaround by programmatically scrolling the view slightly, which makes the hidden refresh control visible on iOS.
The above code uses a
useRefto hold a reference to the<ScrollView>. In theuseEffect, it programmatically scrolls the view slightly upwards after a delay, which makes the refresh control visible.This workaround ensures that the refresh control is displayed properly on iOS when the
refreshingprop is true without pulling.I can confirm that it is still an issue for RN 0.79.5 + Expo SDK 53.0.19 + New Arch enabled.
I’ve tried to understand why it wasn’t fixed by this commit https://github.com/facebook/react-native/commit/e3d607fc2ea18c7ad9474d72cf18b1328d6647f7 . All of a sudden this commit almost fixed the issue, but not completely, I see that actual ‘initial’ pulling is working (list doing it’s animation) but indicator’s view is not visible, and it seems like there is no default color set to indicator, so it basically “invisible”. I’ve added these lines
here
(same file as I’ve mentioned before:
node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm) and it did the trick, everything works as expected in my FlatList, but if you don’t wish to use patch or postinstall scripts to replace the content of that file, you can settintColorexplicitly in place of usage (it’s not the best dev experience but it works with existing components interface) :as you can see in the feed here, fix is already exists, but it’s available only for RN 0.79 https://github.com/facebook/react-native/pull/49240 . I’ve tried it and it works for me on RN 0.77.1, you can apply it locally with
patch-packageor addpostinstallscript which will replace/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mmwith fixed version.I am experiencing this exact problem. In the code example (or in your app), if you pull the screen down a bit you can see the loading icon so it’s there, just not visible.