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

[router] Routing from Push Notification on Android not working #28342

Open
saurori opened this issue Apr 20, 2024 · 0 comments
Open

[router] Routing from Push Notification on Android not working #28342

saurori opened this issue Apr 20, 2024 · 0 comments
Labels
needs review Issue is ready to be reviewed by a maintainer Router expo-router

Comments

@saurori
Copy link

saurori commented Apr 20, 2024

Minimal reproducible example

https://github.com/saurori/expo-router-bug

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

npm

If the issue is web-related, please select the bundler (web.bundler in the app.json)

None

Summary

I've encountered a bug when routing to a href from a notification (in this case using tabs). On expo-router@3.4.8, routing from a notification on ios works as expected. On android, this does not work at all. The notification message press is received and the router attempts to navigate, but nothing happens on screen (if on index) or it shows the index. In my reproducible example, the logs indicate the view the notification is supposed to route to does render, but on screen it stays on the (tabs)/index (aka Tab One) or if you are on (tabs)/three and attempt to route to /two, it will go to (tabs)/index on screen.

To send a notification, I used https://expo.dev/notifications with a Data (JSON) of {"url":"/two"}.

Example log (from reproducible example) loading the app, going to tab Three, then pressing a notification to go to tab Two:

 LOG  Render Tab One
 LOG  not mounted
 LOG  Render Tab Three
 LOG  subscription redirect
 LOG  redirect to: /two
 LOG  Render Tab Two

expo-router@3.5.0 exhibits the same behavior. This may be a separate bug, but in 3.5.0 I noticed that routing to a href from a notification with a param is broken compared to 3.4.8 (tested on ios). So for example, routing to /user/some-uuid where there is a file app/(tabs)/user/[id].tsx will render the view with id as undefined via const { id } = useLocalSearchParams().

Environment

  expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 21.7.1 - /opt/homebrew/bin/node
      Yarn: 2.4.3 - /opt/homebrew/bin/yarn
      npm: 10.5.0 - /opt/homebrew/bin/npm
    Managers:
      CocoaPods: 1.15.2 - /Users/saurori/.gem/ruby/3.2.0/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
    IDEs:
      Android Studio: 2023.2 AI-232.10300.40.2321.11668458
      Xcode: 15.3/15E204a - /usr/bin/xcodebuild
    npmPackages:
      expo: ~50.0.17 => 50.0.17 
      expo-router: ~3.4.8 => 3.4.8 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.73.6 => 0.73.6 
      react-native-web: ~0.19.10 => 0.19.10 
    npmGlobalPackages:
      eas-cli: 7.8.0
    Expo Workflow: managed
@saurori saurori added needs validation Issue needs to be validated Router expo-router labels Apr 20, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Apr 20, 2024
@saurori saurori changed the title [router] Broken and inconsistent router behavior from push notification [router] Routing from Push Notification on Android not working Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer Router expo-router
Projects
None yet
Development

No branches or pull requests

2 participants