question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parent screen goes blank after dismissing a modal screen

See original GitHub issue

I use both card and modal modes of react-navigation’s StackNavigator, as the following structure:

const CardNavigatorData = {
  'Home': {
    screen: HomeScreen,
  },
  'Content': {
    screen: ContentScreen,
  },
}

const CardNavigator = createStackNavigator(CardNavigatorData, {
  initialRouteName: 'Home',
  mode: 'card',
})

const RootNavigatorData = {
  auth: {
    screen: createStackNavigator(
    {
      modalRoot: {
        screen: AuthScreen,
      },
    },,
  },
  cards: {
    screen: CardNavigator,
  },
}

const RootNavigator = createStackNavigator(RootNavigatorData, {
  headerMode: 'none',
  initialRouteName: 'cards',
  mode: 'modal',
})

const RootNavigatorContainer = createAppContainer(RootNavigator)

Nesting these two modes so I can show an Auth modal anywhere inside CardNavigator stacks.

After upgrading to react-native-screens 2.0 version, when I dismiss a modal, like Home -> Push Content -> Show Auth -> Dismiss Auth, then go back from Content to Home, the Home screen goes blank.

Without calling enableScreens everything works well.

Platform: Android react-native: 0.61.5 react-navigation: 4.0.10 react-native-screens: 2.0.0-alpha.13 react-navigation-stack: 1.10.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:12
  • Comments:45 (12 by maintainers)

github_iconTop GitHub Comments

5reactions
cbrevikcommented, Apr 15, 2020

@kmagiera I’ve created a repro-project here: https://github.com/cbrevik/blankmodal

This is using:

"@react-navigation/native": "^5.1.5",
"@react-navigation/stack": "^5.2.10",
"react-native": "0.62.2",
"react-native-screens": "^2.4.0"

For the problem we experienced in our app, the bug seems to be related to the modal screen also wrapping a Stack-Navigator, and the screen navigating to the modal is also wrapped in its own nested Navigator. It doesn’t seem to matter if the nested Navigator is of type Stack or Bottom Tabs.

bug

4reactions
fontesrpcommented, Dec 13, 2019

I’m having the same issue, but only on Android. If I comment the following line, the error stops

enableScreens()

Edit The error occurs on version 2.0.0-alpha.19 also

Edit 2 Downgrading to 2.0.0-alpha.12 solved it for me. It seems the bug started on 2.0.0-alpha.13. Here are the versions that are working for me:

{
  "react-native-screens": "2.0.0-alpha.12",
  "react-navigation": "4.0.10",
  "react-navigation-stack": "1.10.3",
  "react-navigation-tabs": "2.6.0"
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Black Screen After Dismissing Modal Controller
Via the iPhone 6 simulator(split view is always collapsed) I present a modal viewcontroller with the following code: UINavigationController * ...
Read more >
Black screen after presenting modal view controller in current ...
Dismissing the modal leaves the presenting view controller with it's view still removed from the window. Going to tab 2 and returning adds...
Read more >
close the modal form and return to the Parent page ... - MSDN
I have a parent page and there are some text boxes on it، A modal window will open by pressing a button (id="btnprs")...
Read more >
react-native-modal - npm
An enhanced, animated, customizable React Native modal. The goal of react-native-modal is expanding the original React Native <Modal> ...
Read more >
Best Practices For Modal Window Design | by Nick Babich
A modal is a window that appears on top of a parent screen. It's called 'modal' because it creates a mode that disables...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found