react-navigation icon indicating copy to clipboard operation
react-navigation copied to clipboard

fix: using initialRouteName in web, make screen redirects to pages outside app

Open listiani13 opened this issue 2 years ago • 4 comments

Please provide enough information so that others can review your pull request:

Motivation If we set initialRouteName and directly access the deep link, back button on the initial screen keeps redirecting us to page outside app. Preview

https://user-images.githubusercontent.com/24470609/156485734-d4de463c-6562-4317-bbad-bd9d217d7b02.mp4

This PR added a guard to avoid going back outside the app when using App Back Button & supplying initialRouteName. Should address this issue https://github.com/react-navigation/react-navigation/issues/10398

Test plan

  • Create patch for this fix
  • Apply patch to the reproducible bug (I've applied it in here - https://github.com/listiani13/react-navigation-initial-route-name-bug/tree/poc-using-fix)

Preview:

https://user-images.githubusercontent.com/24470609/157353361-3cab3942-a861-48cd-8bde-a9114b466f87.mp4

Make sure you test on both platforms if your change affects both platforms.

It's not affecting native, because I only change useLinking.ts (not .native.tsx)

The code must pass tests.

Code formatting

Look around. Match the style of the rest of the codebase. Run yarn lint --fix before committing.

listiani13 avatar Mar 09 '22 01:03 listiani13

✔️ Deploy Preview for react-navigation-example ready!

🔨 Explore the source changes: b2e44e62c15a7d93af77896ed58cc3904af24885

🔍 Inspect the deploy log: https://app.netlify.com/sites/react-navigation-example/deploys/6227fdb67e209f0007b55bcb

😎 Browse the preview: https://deploy-preview-10414--react-navigation-example.netlify.app/

netlify[bot] avatar Mar 09 '22 01:03 netlify[bot]

Thanks for the PR @listiani13 👍 We have vested interest in seeing it completed & merged (see https://github.com/Expensify/App/issues/8641). Do you think you'll be able to work on the requested changes fairly soon? If not, perhaps it's ok for us to submit another similar PR? Please let us know how you would like to proceed 🙇 cc @frenkield

flodnv avatar Apr 27 '22 14:04 flodnv

Hey @flodnv! Feel free to open similar PR! Sorry I currently didn't have capacity to address the requested changes. Thanks a lot!!

listiani13 avatar Apr 28 '22 02:04 listiani13

@listiani13 I have opened another similar PR. Thanks for allowing https://github.com/react-navigation/react-navigation/pull/10558

cc: @satya164

aneequeahmad avatar May 01 '22 15:05 aneequeahmad