React-native-navigation: [V2] ShowModal does not work on iOS

Created on 7 Jul 2019  路  7Comments  路  Source: wix/react-native-navigation

Issue Description

I use RNN as the following:

Navigation.setDefaultOptions({
      modalPresentationStyle: "pageSheet",
      layout: {
        componentBackgroundColor: "#e8e8e8",
        orientation: ["landscape"]
      },
      topBar: {
        visible: false,
        height: 0
      },
      animations: {
        setRoot: {
          alpha: {
            from: 0,
            to: 1,
            duration: 500
          }
        }
      }
    });

Navigation.setRoot({
      root: {
        stack: {
          children: [
            {
              component: {
                name: screenName,
                passProps
              }
            }
          ]
        }
      }
    });

And push/pop/showOverlay all work well, but showModal works well on android and not work on iOS.
Nothing happens when execute the following code:
Navigation.showModal({ component: { name: screenName, passProps } });

I debug the native code, and find the topVC is nil.
image

When I add [ UIApplication.sharedApplication.delegate setWindow:_mainWindow];
But i am not sure it is right.
image

Could anyone give me a better solution?


Environment

  • React Native Navigation version:2.22.2
  • React Native version: 0.59.9
  • Platform(s) (iOS, Android, or both?): iOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator
馃彋 stale

Most helpful comment

In my project there were two lines of code that we added in order to prevent a white flash during a screen push with the V1. We removed them and now showModal works everywhere.

In AppDelegate.m remove these, if present:

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];

In general: if you added something in AppDelegate with the V1 then try to remove it. Shoutout to @FRizzonelli that is the true hero of this long-term problem.

All 7 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

The issue has been closed for inactivity.

I confirm that 's the bug still exist !

showModal doesn't work on 3.1.1

In my project there were two lines of code that we added in order to prevent a white flash during a screen push with the V1. We removed them and now showModal works everywhere.

In AppDelegate.m remove these, if present:

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = [UIColor whiteColor];

In general: if you added something in AppDelegate with the V1 then try to remove it. Shoutout to @FRizzonelli that is the true hero of this long-term problem.

@FRizzonelli, You saved my all day!!!

@FRizzonelli, You saved my all day!!!

It was a pleasure to be useful :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

henrikra picture henrikra  路  3Comments

bjacog picture bjacog  路  3Comments

bdrobinson picture bdrobinson  路  3Comments

kiroukou picture kiroukou  路  3Comments

birkir picture birkir  路  3Comments