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

https://snack.expo.dev/@danielmorlock/refresh-indicator-bug

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 18
  • Comments: 29

Commits related to this issue

Most upvoted comments

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 a ScrollView.

For us this is still reproducible:

  expo-env-info 1.2.1 environment info:
    System:
      OS: Windows 11 10.0.22631
    Binaries:
      Node: 22.6.0
      Yarn: 1.22.22
      npm: 10.9.1
    IDEs:
      Android Studio: AI-242.23339.11.2421.12550806
    npmPackages:
      expo: ~52.0.14 => 52.0.14
      expo-router: ~4.0.11 => 4.0.11
      react: 18.3.1 => 18.3.1
      react-dom: 18.3.1 => 18.3.1
      react-native: 0.76.3 => 0.76.3
      react-native-web: ^0.19.13 => 0.19.13
    Expo Workflow: bare

<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

const fetchData = ()=>{
    this.setRefreshing(true)
    //... data fetching logic
}


React.useEffect(() => {
    setTimeout(() => {
        state.fetchData()
    }, 10)
}, [])

I have implemented a workaround by programmatically scrolling the view slightly, which makes the hidden refresh control visible on iOS.

import React, { useRef, useState, useEffect } from 'react';
import { ScrollView, RefreshControl } from 'react-native';

const App = () => {
  ....
  const [loading, setLoading] = useState<boolean>(true);

  const scrollRef = useRef<ScrollView>(null);

  useEffect(() => {
    setTimeout(() => {
      scrollRef?.current?.scrollTo({ y: -50 });
    }, 500);
    fetchData();
  }, []);

  const fetchData = () => {
    setLoading(true)
    // Your refresh logic here
    setLoading(false)
  };

  ....
  
  return (
    <ScrollView
      ref={scrollRef}
      refreshControl={
        <RefreshControl
          refreshing={loading}
          onRefresh={fetchData}
        />
      }
    >
    ....
    ....
    </ScrollView>
  );
};

The above code uses a useRef to hold a reference to the <ScrollView>. In the useEffect, 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 refreshing prop 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

 if(!_refreshControl.tintColor) {
    _refreshControl.tintColor = [UIColor colorWithRed:0.67 green:0.67 blue:0.67 alpha:1.0];
  }

here

Image

(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 set tintColor explicitly in place of usage (it’s not the best dev experience but it works with existing components interface) :

<FlatList
        refreshControl={
          <RefreshControl
            refreshing={isRefreshIndicatorVisible()}
            onRefresh={handleRefresh}
            tintColor='#f00'
          />
        }
        ...
 />

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-package or add postinstall script which will replace /node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.mm with 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.