achorein / expo-share-intent

🚀 Simple share intent in an Expo Native Module
MIT License
177 stars 15 forks source link

Not a BUG report - Seeing "Unmatched Route" #28

Closed melnikovkolya closed 6 months ago

melnikovkolya commented 6 months ago

Hi, thank you very much for this package!

Describe the bug I am using expo 50, with app-/directory-based routing.

When the share happens, I see the "Unmatched Route" with the following address: myapp:///dataUrl=myappShareKey.

The rest of the stuff works, e.g., I am able to access the shared data from the share intent context.

To Reproduce Expo 50 App-based router

Using the following approach in the component (after defining the Share Intent Provide at the root layout, as shown in the example):

const { shareIntent, resetShareIntent, error } = useShareIntentContext()

  useEffect(() => {
    if (shareIntent?.text) {
      console.log({ shareIntent }) // <- here I see the data that is being shared, a URL link in this case

      addItemSheetRef.current?.present() // <- bottom sheet expands as expected, however underneath it is that dark screen of 'Unmatched Route'

      resetShareIntent()
    }
  }, [shareIntent])

Environment give the output of the following command npx react-native info

 npx react-native info

  WARNING: You should run npx react-native@latest to ensure you're always using the most current version of the CLI. NPX has cached version (0.73.4) != current release (0.73.6)

info Fetching system and libraries information...
(node:22727) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
System:
  OS: macOS 14.1
  CPU: (8) arm64 Apple M2
  Memory: 125.72 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.2.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.21
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.3
    path: /usr/local/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.11005911
  Xcode:
    version: 15.0.1/15A507
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 16.0.2
    path: /usr/bin/javac
  Ruby:
    version: 3.3.0
    path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.4
    wanted: 0.73.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Additional context I can add an [...unmatched] route, however I don't want to see a blank screen, and instead - remain in the page where the app is currently at.

Thank you for providing us with this uber-awesome package.

Best,

nik

achorein commented 6 months ago

👋 first of all i think you should use version 1.x of expo-share-intent (currently v1.1.1) instead of v0.3 as you're using expo 50. I should add a warning about that in the prebuild output :)

concerning your problem, i don't think it's really important as the warning is not shown in a production build. I didn't find any deeplink configuration for custom parsing in expo-router... It's clearly something about [...unmatched] routes.

An other way it's to tricks the route, what about :

melnikovkolya commented 6 months ago

Hi @achorein,

Thank you. I upgraded to version 1.1.1 and everything works great.

It is a great idea to actually expose the Home page.

It might feel a bit hacky, but it fits my use-case scenario perfectly.

Best reagards,

nik

achorein commented 6 months ago

FYI I updated the example for expo-router using ShareIntentProvider which requires the use of [...unmatched] (only on first app startup)

melnikovkolya commented 6 months ago

@achorein Thank you very much for your time!