Skip to content

Going back in native stack cause crash on Android 7 if screen contains FlatList with refresh props (React Navigation related) #2810

@Zao721

Description

@Zao721

Description

Original issue:
react-navigation/react-navigation#12510

I have such react navigation structure:
Home -> Details

When Details screen contains List components (FlatList, VirtualizedList) with refresh props such as onRefresh, refreshing or refreshControl = <RefreshController...> (React Native component) going back causes app crash and it happens only on Android 7. Other Android versions work as expected.

Can be reproduced on emulators and real devices

In logcat I have two errors:

  • Exception in HostFunction: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
  • java.lang.IndexOutOfBoundsException: getChildDrawingOrder() returned invalid index 1 (child count is 1)

Steps to reproduce

  1. Open example app
  2. Navigate to Details Screen
  3. Go back with ui or with hardware button

Snack or a link to a repository

https://github.com/Zao721/CrashOnGoingBackAndroid7

Screens version

^4.9.2, ^4.10.0

React Native version

78.1

Platforms

Android

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Release mode

Device

Real device

Device model

Samsung Galaxy J2 Pro (Android 7.1.1), Android Emulator 7.1.1

Acknowledgements

Yes

Metadata

Metadata

Assignees

Labels

Platform: AndroidThis issue is specific to AndroidRepro providedA reproduction with a snack or repo is provided

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions