-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
SIGABRT: Application tried to present modally a view controller <RCTModalHostViewController: 0x10412f400> that is already being presented by <UIViewController: 0x1032142e0>. #37198
Comments
The crash happened when we tried to hide the modal window and navigate with react-navigation to another page simultaneously, which is almost always reproducible in my case, could you tag me if any additional info is needed? as a weird workaround - setTimeout |
I havn't been able to make any progress yet @Symous |
@Hmoulvad I found this may happen when we open a Modal component inner Text component in iOS, but I can't find the reason. |
@Symous can you shared some of that code, then I might be able to look through my own stuff too :-) |
I'm running into the same type of issue as:
The tough part for me is, on some screens hiding the modal beforehand (its visibility is toggled by state) consistently works prior to navigating, and in other cases not. In the cases where this works, I am doing something like: setIsProcessing(true);
props.route.params.save(selectedRef.current.map(value => value.value))
.then(() => {
setIsProcessing(false);
props.navigation.goBack()
}); where the state setting toggling the visibility of the modal open and closed is prior to an async callback. In the cases where it doesn't work, the state had been set in a previous I'm getting better with React every day but I'm still not entirely sure where the race condition is. But if you must hide a modal prior to navigating away it seems like putting the navigation call in an immediately-resolved In that sense I don't think this is a React bug so much as a race condition related to RN's processing of state updates and the native components created from them. I guess there could be a bug there, but anyway, this is my experience and perhaps an elaboration on the |
This is happening on RN 0.70.12 as well. |
same issue |
same in here |
+1 |
hi @luccaroli , would you mind to share your approach of solving this issue using |
actually I can only solve it with settimeout @7dp :/ |
The problem in my case was that a modal from "react-native-modal" was being rendered on top of another rendered modal (from a different lib). Once I replaced the "react-native-modal" with the one from another UI lib it worked just fine. |
I'm getting this error when using the Modal component provided by React Native. |
|
For me the issue appeared when I tried to navigate to another screen, while the Modal I have is present. So what I did to fix this was moving the code navigating to a screen, to the OnModalHide function, so it happens after the Modal is closed. Hope it helps you guys. |
But is that an accepted behaviour? This should be a bug right? |
In my case, it was because I set isVisible to false in the finally block of the try/catch and in the try block, I navigated to another screen with react navigation |
I had face this issue multiple times need to set timeout and it never came in the emulator |
something like this can help
|
I facing this issue on react-native:0.73.7 |
I had the same issue when navigating to the app using a deep link and a Modal was showing for the user. To solve it I added the prop |
Hi guys. I had faced same issue until know on 24/08/19 RN 0.74.4, with React-Native-Element-Dropdown, React-native-google-mobile-ads I think this is a problem with rendering life cycle between React and IOS If you try to render a nested View Controller (On Ios) this issue occur. In my case the error code looks like this : Attempt to present <RCTRedBoxController: 0x13a57ede0> on <UIViewController: 0x11d609580> (from <UIViewController: 0x11d609580>) which is already presenting <RCTModalHostViewController: 0x12ebbe380>. so the simple solution this problem is control rendering order. JS Native API like setTImeout or queueMicroTask after close modal or something like it. // ex)
onChange={item => {
store.setFromCurrencyMeta(item);
fromDropdownRef.current?.close();
setTimeout(() => {
showInterstitialAd();
}, 1000);
}} |
Hi @cortinico, sorry for tagging you here. |
We don't monitor closed issues. Please open a new issue against React Native 0.75 with a reproducer, and we can look into it |
Description
We are experiencing this error recently within our application, it came after updating to latest version of React Native. Do you have any suggestions for me on how to debug this, I can't seem to reproduce this myself.
React Native Version
0.71.7
Output of
npx react-native info
System:
OS: macOS 13.3.1
CPU: (10) arm64 Apple M1 Pro
Memory: 216.97 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.12.1 - /opt/homebrew/lib/ruby/gems/2.7.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.1 AI-221.6008.13.2211.9619390
Xcode: 14.3/14E222b - /usr/bin/xcodebuild
Languages:
Java: 17.0.4 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.7 => 0.71.7
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Havn't found a way yet to reproduce it all I get to from the crash is:
SIGABRT: Application tried to present modally a view controller <RCTModalHostViewController: 0x10412f400> that is already being presented by <UIViewController: 0x1032142e0>.
Snack, code example, screenshot, or link to a repository
The text was updated successfully, but these errors were encountered: