ScreenContainer crashes when rendered inside a React Native Modal

Open
#1,769 11 comments 8 reactions 1 assignee View on GitHub

@kkafar is already working on this.

Since Apr 27, 2024.

Assessment

This issue has not been assessed yet.

Description

action:wontfix platform:android type:bug
Description

ScreenContainer tries to read a FragmentManager from the ReactRootView but if this is being rendered within a Modal component the native view will be attached to a DialogRootViewGroup which is attached to the native android.app.Dialog, so its not a child of a ReactRootView. A Dialog is the only way to trap screen reader focus on Android, so we have some use cases where we have to structure it this way.

As far as I can tell, it's just trying to read a FragmentManager from ReactRootView but it should be able to find a FragmentManager when nested inside DialogRootViewGroup as well

Steps to reproduce
  1. Create a native stack navigator with createNativeStackNavigator
  2. Render it inside Modal
  3. Run on an Android device
Snack or a link to a repository

https://gist.github.com/aweary/1f031cedb1cf0998597119acfa2373b7

Screens version

3.18.2

React Native version

0.70

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

Dominant language
TypeScript
Stars
3.7k
Forks
714
Avg merge
2d 23h
Merged PRs (30d)
71

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from software-mansion/react-native-screens

All issues in software-mansion/react-native-screens

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.