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

useSegment and usePathname return the wrong value on deeplinking #563

Open
wcastand opened this issue May 10, 2023 · 1 comment
Open

useSegment and usePathname return the wrong value on deeplinking #563

wcastand opened this issue May 10, 2023 · 1 comment
Assignees

Comments

@wcastand
Copy link

wcastand commented May 10, 2023

Which package manager are you using? (Yarn is recommended)

yarn

Summary

Bug deeplink

Using the expo-router template: npx create-expo-app@latest --example with-router
update react-native for warning npx expo install --check

  • On a macbook air: M1 apple chip
  • testing on iOS simulator

When coming from a deeplink, the hook like useSegments or usePathname don't have the right value. i tried with and without unstable_settings and the result are the same.

If you do something like npx uri-scheme open "exp://192.168.1.9:19000/--/home" --ios
It will render the right screen (home) but the hook will return

 LOG  /undefined ["[...404]"]

I don't know if expo go is using deeplink by default to open the app because it also happens on reload in this example.

The app i'm working on only has the wrong pathname on deeplink (using expo-dev)

In my app the first render from the deeplink has the right screen( the one requested in deeplink) but the hook return / for pathname and [] for segments.

Bug received / expected

  • deeplink to the app
npx uri-scheme open "exp://192.168.1.9:19000/--/home" --ios

received:

 LOG  /undefined ["[...404]"]

expected:

 LOG  /home ["home"]

Minimal reproducible example

https://github.com/wcastand/deeplinkbug

@maxwowo
Copy link

maxwowo commented May 27, 2023

Also experiencing the same issue, running with expo start --ios with dependencies

"expo": "~48.0.15"
"expo-router": "^1.5.3"
"expo-linking": "~4.0.1"

@EvanBacon EvanBacon self-assigned this Jul 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants