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.

[native-stack] modals are only dismissible on iOS 13

See original GitHub issue

In a barebones project I can’t get a modal to dismiss on iOS 11 or 12.

import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from 'react-native-screens/native-stack';
import {enableScreens} from 'react-native-screens';

enableScreens();

import Root from './Root';
import Modal from './Modal';

const Stack = createNativeStackNavigator();

const App = () => (
  <NavigationContainer>
    <Stack.Navigator screenOptions={{stackPresentation: 'modal'}}>
      <Stack.Screen name="ROOT" component={Root} />
      <Stack.Screen name="MODAL" component={Modal} />
    </Stack.Navigator>
  </NavigationContainer>
);

export default App;

When an action is fired from Modal to dismiss or navigate back to Root the screen seems to be unmounted based on the performance monitor.

before navigation.goBack() or navigation.navigate('ROOT') is called: Simulator Screen Shot - iPhone X - 2020-03-22 at 12 22 24

after navigation.goBack() or navigation.navigate('ROOT') is called: Simulator Screen Shot - iPhone X - 2020-03-22 at 12 22 29

It doesn’t animate away and loses all responsiveness.

Everything works fine in iOS 13. Any thoughts?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
DanielMarkielcommented, Oct 27, 2020

@WoLewicki I can confirm that #643 fixes the issue described above.

1reaction
tdorancommented, Apr 15, 2020

I think there may be two issues being discussed here:

  1. When using react-screens’ createNativeStackNavigator, on iOS devices below iOS13, modals are not dismissable. I believe this is what is being references in the first post in this issue.

  2. When using react-native-screens 2.4.0 and the transparentCard option on a createStackNavigator from react-navigation: after dismissing a modal, it immediately reappears and is not dismissable.

No. 2 is solvable by using createNativeStackNavigator.

I believe 1 should be fixed by https://github.com/software-mansion/react-native-screens/pull/441 , but I’ve tested it and this hasn’t fixed it for me.

I don’t suppose you’ve had any recent luck with this @alexichristakis ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable the interactive dismissal of presented view controller
Since the iOS 13, UIViewController contains a new property called isModalInPresentation which must be set to true to prevent the interactive ...
Read more >
Opening a modal - React Navigation
The modal behavior slides the screen in from the bottom and allows the user to swipe down from the top to dismiss it...
Read more >
react-native-screens - npm
To take advantage of the native stack navigator primitive for React ... modal will use UIModalPresentationAutomatic on iOS 13 and later, ...
Read more >
viewWillAppear and modalview | Apple Developer Forums
hi, with ios13 when i call dismiss of modalview not call viewWillAppear on ... a storyboard by checking the modal presentation style of...
Read more >
createStackNavigator - React Navigation - Netlify
On iOS the stack navigator can also be configured to a modal style where screens ... If false , the on screen keyboard...
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