Description
I customized a Modal component using the Animated.View component with entering and exiting props. When the Modal closes and navigates to another screen, the app crashes with the error: java.lang.NullPointerException: Attempt to read from field 'int android.view.View.mViewFlags' on a null object reference in method 'void android.view.ViewGroup.dispatchGetDisplayList()'.
I tried removing the exiting prop, and the crash didn't happen.
Not all devices crash—most crashes are related to Oppo/Realme, etc.
Steps to reproduce
- create a project with expo (npx create-expo-app@latest)
- reset project (npm run reset-project)
- install dependency (npx expo install ahooks react-native-get-random-values uuid react-native-keyboard-controller react-native-paper)
- prebuild (expo prebuild)
- add two screen (index and test)
- add Modal component
- add a button to open a drawer on index screen
- navigate to test screen on Modal callback "onConfirm"
- build a release app and install to a device (oppo or realme)
- open the app in default index screen, click the button to open the drawer and then click the action
- the screen change to test screen and then the app crash
Snack or a link to a repository
https://github.com/rpyoyo/crash-reproduction-react-native-reanimated.git
Reanimated version
4.1.3
Worklets version
0.6.1
React Native version
0.81.4
Platforms
Android
JavaScript runtime
Hermes
Workflow
Expo Dev Client
Architecture
New Architecture (Fabric renderer)
Build type
Release app & production bundle
Device
Real device
Host machine
Windows
Device model
Realme GT Neo (RMX3350) Android 13
Acknowledgements
Yes