Skip to content

[iOS] Flatlist bug: update refreshing prop programmatically #25898

@elkinjosetm

Description

@elkinjosetm

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

  1. Render a FlatList with some content and a refreshing property
  2. 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>
			) }
		/>
	);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComponent: FlatListPlatform: iOSiOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions