microsoft / microsoft/react-native-windows
Deep linking doesn't work if the app isn't running
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 17.3k
- Forks
- 1.2k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Description
Environment
Run the following in your terminal and copy the results here.
npx react-native --version:
4.13.1
npx react-native info:
System:
OS: Windows 10 10.0.19042
CPU: (8) x64 Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
Memory: 1.98 GB / 15.60 GB
Binaries:
Node: 12.9.1 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.5 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.10.2 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions: 10.0.14393.0, 10.0.15063.0, 10.0.17763.0, 10.0.18362.0, 10.0.19041.0
IDEs:
Android Studio: Not Found
Visual Studio: 16.8.30907.101 (Visual Studio Enterprise 2019), 16.9.30914.41 (Visual Studio Enterprise 2019)
Languages:
Java: Not Found
Python: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
react-native-windows: ^0.63.0-0 => 0.63.18
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
- Open the manifest of the application and, in the Declaration tab, register a protocol (for example, foo:)
- In the React Native code, reference the Linking module, then add a button which invokes the following function:
const getLinkUrl = async() => {
const url = await Linking.getInitialURL();
console.log(url);
}
- Close the application
- Press Win-R and invoke the application using the protocol you have registered (for example, by typing foo:/details?id=1)
Expected Results
The application starts and, when I press the button, the Linking.getInitialURL() function returns the URL used to invoke the app. Instead, I always get null. The problem happens only if the app isn't running. If it's already running, the app is brought to foreground and the code works.
Snack, code example, screenshot, or link to a repository:
The official sample app in the React Native for Windows repo implements this scenario.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the official sample app in packages/microsoft-reactnative-sampleapps and the Linking.getInitialURL() call described in the issue. Reproduce a protocol launch with the app closed, comparing it with the working case when the app is already running. Done means the app starts from the registered protocol and getInitialURL() returns the invoked URL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- desktop, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100