software-mansion / react-native-screens

Native navigation primitives for your React Native app.
https://docs.swmansion.com/react-native-screens/
MIT License
3.11k stars 521 forks source link

after react-native-screens 4.2.0 upgrade, app crashes with `viewpager2 does not support direct child views` #2529

Closed paulschreiber closed 4 days ago

paulschreiber commented 5 days ago

Description

In our app, after upgrading from react-native-screens 4.1.0 to 4.2.0, hitting the back button causes the app to crash with a viewpager2 does not support direct child views error.

Crash occurs only on Android. No crash on iOS.

Error with stack trace:

There was a problem loading the project.
This development build encountered the following error.
ViewPager2 does not support direct child views

onViewAdded
VionPager2.java
dispatchViewAdded
VienGroup. java addViewInner
VienGroup. java addVien
VienGroup. java addVien
VienGroup. java addVien
VienGroup. java
startTransitionRecursive
Screen.kt
startTransitionRecursive
Screen.kt
startTransitionRecursive
Screen.kt
startTransitionRecursive
Screen.kt
startTransitionRecursivel
Screen.kt
startTransitionRecursive
Screen.kt

Steps to reproduce

  1. Open LandPKS Soil ID app
  2. Open a site (or create one if no sites exist)
  3. Tap back button in top left corner

Snack or a link to a repository

https://github.com/techmatters/terraso-mobile-client/

Screens version

4.2.0

React Native version

0.75.4

Platforms

Android, iOS

JavaScript runtime

None

Workflow

Expo bare workflow

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

Android emulator

Device model

Pixel 6a API 35

Acknowledgements

Yes

github-actions[bot] commented 5 days ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

paulschreiber commented 5 days ago

Looks like this might be fixed with https://github.com/software-mansion/react-native-screens/pull/2527.

kkafar commented 5 days ago

If you have capacity to patch your project with https://github.com/software-mansion/react-native-screens/pull/2531 and let me know whether it resolves it issue it would be great.

kkafar commented 5 days ago

Once I get some confirmation I'll release a version with the fix.

paulschreiber commented 3 days ago

Confirmed fixed in 4.3.0.

kkafar commented 3 days ago

Thanks!