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.

ios: cannot dismiss Modal

See original GitHub issue

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

When modal is dismissed the whole screen turns black. see video

React Native version:

System:
    OS: macOS 11.6
    CPU: (8) x64 Apple M1
  Binaries:
    Node: 14.15.4 - /usr/local/bin/node
    npm: 7.6.3 - /usr/local/bin/npm
    Watchman: 4.9.0 - /opt/homebrew/bin/watchman
  IDEs:
    Android Studio: Not Found
    Xcode: 13.0/13A233 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_302 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: ~0.66.0 => 0.66.0
    react-native-macos: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. use this code with react native 0.66 on iOS

video

RCTModalHostViewController is what’s blocking the screen Screenshot 2021-10-04 at 6 54 47 pm

Screenshot 2021-10-04 at 6 49 43 pm .

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:29
  • Comments:68 (2 by maintainers)

github_iconTop GitHub Comments

23reactions
Humadcommented, Oct 7, 2021

Another update – Here’s what I ended up doing:

<View style={{flex: 1}}>
    <Modal visible={isVisible}></Modal>
</View>

This seemed to work, though I’m not sure why wrapping it with a View with flex: 1 is needed 🤔

I also then noticed that if I have multiple modals on the same page, this issue is only fixed for the first one (likely because of the flex: 1). So I updated the code to be

{isFirstModalVisible && (
    <View style={{flex: 1}}>
        <Modal visible={isFirstModalVisible}></Modal>
    </View>
)}

{isSecondModalVisible && (
    <View style={{flex: 1}}>
        <Modal visible={isSecondModalVisible}></Modal>
    </View>
)}

That way the modals are only rendered when visible, and there’s only 1 modal on a page at a time.

This has solved my issue for now, but I wish I didn’t have to do all this. Really hoping this issue is looked into.

18reactions
littleskicommented, Oct 14, 2021

Hello, Version 2.2.3 of react-reanimated seems to fix the issue on our side. Regards

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot dismiss Modal in swift - Stack Overflow
I have an issue dismissing Modal ViewController in swift. When I call the code below nothing happens: confirmPopup.dismiss(animated: true, ...
Read more >
iOS Lifecycle When Dismissing a Modal View With ...
If the property is true , the view, which is displayed onscreen modally, is prevented from being dismissed. In other words, the modal...
Read more >
ion-modal: Ionic Mobile App Custom Modal API Component
ion-modal is a dialog that appears on top of mobile app content, and must be dismissed before interaction resumes. Learn more about custom...
Read more >
iOS 14 (SwiftUI) Sheet Modals not … | Apple Developer Forums
Sometimes the modals act perfectly as usual · Sometimes (most of the time) I have to kill the app because the modal is...
Read more >
Dismissing a SwiftUI modal or detail view - Swift by Sundell
So that's three different ways to dismiss a SwiftUI modal or detail view — two of which that are backward compatible with iOS...
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