Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blank screen on iOS when using react-navigation/native-stack #2405

Closed
seyedmostafahasani opened this issue Oct 14, 2024 · 6 comments · Fixed by #2406
Closed

Blank screen on iOS when using react-navigation/native-stack #2405

seyedmostafahasani opened this issue Oct 14, 2024 · 6 comments · Fixed by #2406
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided

Comments

@seyedmostafahasani
Copy link

seyedmostafahasani commented Oct 14, 2024

Description

We're using react-navigation/native-stack in our app and react-native-screens version 4.0.0-beta.10. However, when running the iOS app, we encounter a blank screen, while the Android app works correctly with the same configuration.
It works correctly with react-native-screens version 4.0.0-beta.8 on iOS.

Steps to reproduce

Initialize a new project, then add the react-navigation library with all its dependencies. Also, add react-navigation/native-stack to handle stacks. If you open the app, you will see a blank screen.

simulator_screenshot_AD98FE01-8385-4139-9320-0CC938B1A8E7

Snack or a link to a repository

https://github.com/seyedmostafahasani/sample

Screens version

4.0.0-beta.10

React Native version

0.75.4

Platforms

iOS

JavaScript runtime

None

Workflow

React Native (without Expo)

Architecture

Fabric (New Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

@github-actions github-actions bot added Repro provided A reproduction with a snack or repo is provided Platform: iOS This issue is specific to iOS labels Oct 14, 2024
@seyedmostafahasani
Copy link
Author

@kkafar
I've identified the issue in the RNSScreenStack.mm file, specifically in the updateContainer function:

if (!screen.dismissed && screen.controller != nil && screen.activityState != RNSActivityStateInactive) {
      if (pushControllers.count == 0) {
        // first screen on the list needs to be places as "push controller"
        [pushControllers addObject:screen.controller];
      } else {
        if (screen.stackPresentation == RNSScreenStackPresentationPush) {
          [pushControllers addObject:screen.controller];
        } else {
          [modalControllers addObject:screen.controller];
        }
      }
    }

When I remove this condition screen.activityState != RNSActivityStateInactive, everything works correctly.

@kkafar
Copy link
Member

kkafar commented Oct 15, 2024

@seyedmostafahasani, thanks for detailed report!

I'm aware of the issue since yesterday, most likely #2389 introduced the regression, however I do not know what's the reason yet. Will be looking into it in upcoming hours.

Meanwhile, please make sure that you're using latest react-navigation v7 and not v6.

@seyedmostafahasani
Copy link
Author

@kkafar
Thank you for following up. I will test with react-navigation v7 and let you know the result.

@kkafar
Copy link
Member

kkafar commented Oct 15, 2024

Fixed by #2406

@seyedmostafahasani, please note that screens v4 is meant to be used together with react navigation v7. We won't support react navigation v6 on v4 line of this library.

@kkafar kkafar closed this as completed Oct 15, 2024
@kkafar
Copy link
Member

kkafar commented Oct 15, 2024

I've released 4.0.0-beta.12, which contains the fix.

@seyedmostafahasani
Copy link
Author

@kkafar
Thanks again! I appreciate you taking the time to fix it.
I tested with beta.9 and react-navigation v7, and everything works correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform: iOS This issue is specific to iOS Repro provided A reproduction with a snack or repo is provided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants