Comments (4)
Hi @esutton, did you add the getInitialURL()
method to your app?
This method is called when a deep link launches the app.
componentDidMount() {
Linking.getInitialURL().then((url) => {
if (url) {
Linking.openURL(url);
}
}).catch(err => console.error('An error occurred', err));
}
If yes, is componentDidMount
being called?
This might also be a misconfiguration in your AppDelegate.m
I'm updating the example to handle this case.
from react-native-deep-linking.
Hi @luisfcofv, no I did not use getInitialURL()
All I had was.
componentDidMount() {
Linking.addEventListener('url', this._handleOpenURL);
},
I will try getInitialURL()
I can see openURL being called in AppDelegate.m
. I can copy email attachments to iOS app if app had been launched previously.
Thanks again!
from react-native-deep-linking.
Works great! Thank you @luisfcofv
componentDidMount() {
Linking.getInitialURL()
.then(url => {
if (url) {
const event = {};
event.url = url;
this._handleOpenURL(event);
}
})
.catch(err => console.error('An error occurred', err));
Linking.addEventListener('url', this._handleOpenURL);
},
from react-native-deep-linking.
I don't think your timeout is necessary.
One tip, no need to call this._handleOpenURL
inside getInitialURL()
You can have your function as:
import { Linking } from 'react-native'
...
componentDidMount() {
Linking.addEventListener('url', this._handleOpenURL);
Linking.getInitialURL()
.then(url => {
if (url) {
Linking.openURL(url);
}
})
.catch(err => console.error('An error occurred', err));
}
Closing this issue :)
from react-native-deep-linking.
Related Issues (20)
- Not working on android HOT 2
- Add Android example HOT 3
- addRoute sometimes does not work [ios] HOT 1
- RCTLinkingManager.h is not found in IOS HOT 2
- Best practice for catch all route? HOT 1
- How to test deep linking in iOS? HOT 2
- Not working when the app closed [Android] HOT 2
- Reset Scheme Option ? HOT 3
- Typescript definitions HOT 2
- addEventListener is not working in IOS?
- support deep linking while using url shcme to open app? HOT 2
- An in-range update of eslint-plugin-react is breaking the build 🚨 HOT 11
- Query params inside last uri param HOT 2
- How to open HTTPS URL from the link - iOS HOT 1
- Event listener not working on iOS HOT 1
- this lib is not working with react-native version 0.63.3 HOT 1
- Does this lib can work with Expo? Or do you have similar tool which works?
- Query params Deep link not working
- Cannot handle multiple params in a single url
- How to get full URL from addRoute callback/handler
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-deep-linking.