-
-
Notifications
You must be signed in to change notification settings - Fork 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
Replacing a native stack navigation screen crashes the app on iOS if a modal is open #11201
Comments
Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a snack.expo.dev link, a www.typescriptlang.org/play link or link to a GitHub repo under your username). Can you provide a minimal repro which demonstrates the issue? Please try to keep the repro as small as possible and make sure that we can run it without additional setup. A repro will help us debug the issue. The issue will be closed automatically after a while if you don't provide a repro. |
Couldn't find version numbers for the following packages in the issue:
Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3. |
The versions mentioned in the issue for the following packages differ from the latest versions on npm:
Can you verify that the issue still exists after upgrading to the latest versions of these packages? |
I am getting the same issue when using |
I have a very similar issue. It's crashing on iOS when calling
It does not crash with react-native 0.70.x |
Any update here please? |
I'm getting same issue any fix? |
@hichemBAALI and @sebasg0 do you have new architecture enabled? In my case, that's what's causing the crash: #11270. For now, I have reverted to not use the new architecture for iOS. |
I had the same issue, apparently it was happening only when the modal was being rendered Since i did not found a good fix to this, i did short-term solution, i don't like it but it is what it is, perhaps it can help you in the meantime I use the renderModal state to control if the modal is rendered, once you click the button to close the modal it changes the renderModal state which executes the useEffect hook triggering the replace I am not that experienced in React Native, so any corrections to the code would be appreciated function HomeScreen({navigation}: {navigation: any}) {
const [modalVisible, setModalVisible] = React.useState(false);
const [renderModal, setRenderModal] = React.useState(true);
useEffect(() => {
if(!renderModal){
navigation.dispatch(StackActions.replace('Home'));
}
}, [renderModal])
return (
...
{renderModal &&
<Modal isVisible={modalVisible} useNativeDriver>
<View style={{marginTop: '50%'}}>
<Button
title="Close"
onPress={() => {
setModalVisible(false);
setRenderModal(false);
}}
/>
</View>
</Modal>
}
...
);
} |
This issue is still active. It started after we updated our react native version 0.71.4. We are getting same crashes. If a modal is open, and we try to go back and navigate to the same screen without closing modal app crash.
|
This is happening on RN 0.70.12 as well |
Hey! Thanks for opening the issue. Seems that this issue is related to |
I opened this issue with them awhile back. No action yet. |
hey @curthipster, already opened one here |
I got the issue with with replace screen is crash on IOS temporary solution I using navigate instead of replace |
I am using |
Put the navigation function into setTimeOut or delay (lodash ) function , it will oke |
setTimeout is fixing the issue but has some weird different issues. Did anyone any other workarounds or fix? |
Calling navigation.reset() function when onModalHide works for temporary solution till fixed |
This is happening when I'm trying to replace a screen inside of a top-level stack navigator which is presented in a full screen modal. As a workaround I used Also used |
Still happening. I fixed it by using a setTimeout(), but it is not the ideal... |
Can confirm it's still happening in RN 0.72.4 with an open modal. |
same on RN 0.72.6 |
I tried on RN 0.73.0 and the same issue is present. I hope some of the maintainers are looking into this. |
I having this issue also with the Any solution for this? :( |
@oluwajuwon can't thank you more, your solution solve my IOS Crash issue |
this method work for us. but its not a proper way 🚀🚀 |
Same issue,Temporary solution is using setTimeout. |
Same crash here, im using 0.73.6 and still crashing, provisional solution is using a timeout :( |
As per software-mansion/react-native-screens#1832 (comment) this seems to a bug in React Native. So I'm closing this. Please open an issue in React Native repo. |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Import Modal from react native instead of importing it from react-native-modal. |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
Current behavior
This issue is dependent on having
react-native-modal
library installed. I'm unsure where the root cause is, so I am reporting this bug in this repository.The crashing did not occur in react-native version 0.70.x. The crash happens in version 0.71.2
If I have a
react-native-modal
open, callingnavigation.dispatch(StackActions.replace(<route name>));
will crash the appError logged:
Expected behavior
Replacing the screen should not crash the app regardless if a
react-native-modal
is open or notReproduction
https://github.com/juho-ylikyla/rn-navigation-crash-repro
Platform
Packages
Environment
The text was updated successfully, but these errors were encountered: