Skip to content
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

navigation.reset makes iOS app crash without error #11259

Closed
2 of 11 tasks
MSetnik opened this issue Mar 2, 2023 · 26 comments
Closed
2 of 11 tasks

navigation.reset makes iOS app crash without error #11259

MSetnik opened this issue Mar 2, 2023 · 26 comments

Comments

@MSetnik
Copy link

MSetnik commented Mar 2, 2023

Current behavior

when using navigation.reset, iOS app crash without error on react native v0.71.3.
Android app works fine.

on RN v0.70.6, app on both platforms works fine

Expected behavior

navigation.reset should not crash the app

Reproduction

cannot provide repo

Platform

  • Android
  • iOS
  • Web
  • Windows
  • MacOS

Packages

  • @react-navigation/bottom-tabs
  • @react-navigation/drawer
  • @react-navigation/material-top-tabs
  • @react-navigation/stack
  • @react-navigation/native-stack
  • react-native-tab-view

Environment

  • [] I've removed the packages that I don't use
package version
@react-navigation/native ^6.1.6
@react-navigation/bottom-tabs ^6.5.7
@react-navigation/native-stack ^6.9.12
react-native-safe-area-context ^4.5.0
react-native-screens ^3.20.0
react-native 0.71.3
expo ^48.0.4
@github-actions
Copy link

github-actions bot commented Mar 2, 2023

Couldn't find version numbers for the following packages in the issue:

  • @react-navigation/native
  • @react-navigation/drawer

Can you update the issue to include version numbers for those packages? The version numbers must match the format 1.2.3.

@github-actions
Copy link

github-actions bot commented Mar 2, 2023

Hey @MSetnik! Thanks for opening the issue. It seems that the issue doesn't contain a link to a repro.

The best way to get attention to your issue is to provide an easy way for a developer to reproduce the issue.

You can provide a repro using any of the following:

A snack link is preferred since it's the easiest way to both create and share a repro. If it's not possible to create a repro using a snack, link to a GitHub repo under your username is a good alternative. Don't link to a branch or specific file etc. as it won't be detected.

Try to keep the repro as small as possible by narrowing down the minimal amount of code needed to reproduce the issue. Don't link to your entire project or a project containing code unrelated to the issue. See "How to create a Minimal, Reproducible Example" for more information.

You can edit your original issue to include a link to the repro, or leave it as a comment. The issue will be closed automatically after a while if you don't provide a repro.

@curthipster
Copy link

I wonder if this is related to #11201

@MSetnik
Copy link
Author

MSetnik commented Mar 6, 2023

I wonder if this is related to #11201

Yes it is!
Unfortunatly, didnt find the fix for it yet :(

@fr0staman
Copy link

I confirm that too, only on iOS.

@curthipster
Copy link

@MSetnik or @fr0staman do either of you have a simple repro? I just started to create a snack, but they don't support Expo 48 yet, which is required for RN 0.71.x.

If not, I'll see if I can whip together a quick repo. This is blocking my RN upgrade.

@kartikbhalla12
Copy link

kartikbhalla12 commented Mar 7, 2023

calling the reset function with setTimeout 0 seems to solve the issue for now

@MSetnik
Copy link
Author

MSetnik commented Mar 7, 2023

calling the reset function with setTimeout 0 seems to solve the issue for now

Can confirm, this is current workaround

@curthipster
Copy link

calling the reset function with setTimeout 0 seems to solve the issue for now

Unfortunately, that doesn't work for me. My issue is a little different, which is that the app crashes when calling navigation.replace while a modal is showing.

I can also work around by changing to

navigation.pop();
setTimeout(() => navigation.push(), EMPIRICALLY_OBSERVED_VALUE);

and EMPIRICALLY_OBSERVED_VALUE varies from 500 to 1000ms in my tests, which is clearly non confidence-inspiring or ideal.

@curthipster
Copy link

I have discovered that my issue is only happening with New Arch enabled. I logged #11270, as it's unclear if it's related to this issue at all.

@github-actions
Copy link

github-actions bot commented Apr 7, 2023

Hello 👋, this issue has been open for more than a month without a repro or any activity. If the issue is still present in the latest version, please provide a repro or leave a comment within 7 days to keep it open, otherwise it will be closed automatically. If you found a solution or workaround for the issue, please comment here for others to find. If this issue is critical for you, please consider sending a pull request to fix it.

@alexanderblackh
Copy link

This isn't happening on iOS for my project, however, it is happening on Samsung Galaxy devices only, and only when using Navigation.reset. I don't believe this is fixed and it should be reopened. The timeout workaround isn't working for us sadly.

@github-actions
Copy link

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.

@Manikanta-GEP
Copy link

Even timeout solution not working for me

@Leslie-Wong-H
Copy link

I use this workaround.

navigation.popToTop();
setTimeout(() => {
   navigation.replace('Home');
}, 0);

@eidan66
Copy link

eidan66 commented Feb 22, 2024

Hey!
It's still happened with the setTimeout solution.

Any other fix maybe?

@LucSilveira
Copy link

LucSilveira commented Mar 4, 2024

Hey, in my case, i soluted this using two steps

First, define de timging in animation close using the property animationOutTiming={0} in modal
ex : <Modal {...rest} visible={visible} transparent={true} animationType='fade' animationOutTiming={0}>

Second, i seted on button to close modal, applying this function
async function handleClose(){ await setShowModalAppointment(false) navigation.replace("Medico Prontuario") }

That way, i can close modal and replace the stack to other screen (that's was my problem). obviously has a little problem about the visual animation, but was enough to resolve the problem

@GabCostaSilva
Copy link

I use this workaround.

navigation.popToTop();
setTimeout(() => {
   navigation.replace('Home');
}, 0);

Worked for me!

@sciranka
Copy link

sciranka commented May 2, 2024

The iOS app (simulator, iOS 17.4) crashed after I updated react-native from 0.73.7 to 0.74.0.
setTimeout didn't work for me, the app still crashed.
For now I reverted RN update.

@rahuls225632
Copy link

Change "react-native-reanimated": "^3.8.1" to "react-native-reanimated": "^3.11.0"
it worked for me

@GabrielDokov
Copy link

Still crash the Expo app on IOS device, when returning back to the screen using navigation.navigate("Screen"), is there a solution , how to stop that
These are the packages :

"@react-navigation/bottom-tabs": "^6.5.20",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"react-native-screens": "3.31.1",
"react-native-safe-area-context": "4.10.1"

@Srh07
Copy link

Srh07 commented May 13, 2024

Also happening here when going back with navigation.goBack() or navigation.popToTop()

"react-native": "0.72.13",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"react-native-screens": "3.31.1",
"react-native-safe-area-context": "4.10.1"

@GabrielDokov
Copy link

GabrielDokov commented May 13, 2024

@Srh07 try installing npm i react-native-reanimated and expo install react-native-reanimated" (if you are using Expo), reload the app and it needs to be fixed, this worked for me

@Srh07
Copy link

Srh07 commented May 13, 2024

@GabrielDokov thanks for the tip, however reanimated was already installed. I also tried reinstalling all of my node_modules and pods but unfortunately it's still not working.

@syedumerali101
Copy link

Import Modal from react native instead of importing it from react-native-modal.

@Srh07
Copy link

Srh07 commented May 15, 2024

I got it working again with the following versions:
"react-native": "0.72.13",
"react-native-reanimated": "3.8.1",
"@react-navigation/native": "^6.1.17",
"@react-navigation/native-stack": "^6.9.26",
"react-native-screens": "3.31.1",
"react-native-safe-area-context": "4.10.1"

The major thing I did was downgrading "react-native-reanimated" from 3.9.0 tot 3.8.1 and doing a "Clean build" within XCode. Only resetting cache when starting metro didn't seem enough.

note: I always use Modal from react-native, so this was not an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests