Comments (3)
@StuffWeDoCo The library works for both platforms, it's not iOS only. The docs are updated for both platforms. However, the example provided only shows iOS.
Feel free to send a pull request if you are feeling useful.
from react-native-deep-linking.
For anyone that lands here after some googeling, this seems to work. Based on the case you want to call test://lost-password
:
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="test"
android:host="lost-password"/>
</intent-filter>
</activity>
The basic difference to https://developer.android.com/training/app-links/deep-linking is this line: android:launchMode="singleTask"
.
In my case I wrote a middleware for redux to then decide whether I want to open a route or not:
import _ from 'lodash';
import DeepLinking from 'react-native-deep-linking';
import { Linking } from 'react-native';
import Screens from '../../constants/Screens';
import { NavigationActions } from 'react-navigation';
import { REHYDRATE } from 'redux-persist';
DeepLinking.addScheme('test://');
const handleUrl = ({ url }) => {
Linking.canOpenURL(url).then((supported) => {
if (supported) {
DeepLinking.evaluateUrl(url);
}
});
};
Linking.addEventListener('url', handleUrl);
function deepLinkingMiddleware () {
return ({ dispatch, getState }) => next => action => {
if (action.type === REHYDRATE) {
DeepLinking.addRoute('/lost-password/:token', (response) => {
dispatch(NavigationActions.navigate({
params: {
token: response.token,
},
routeName: Screens.ResetPassword,
}));
});
}
return next(action);
};
}
export {
deepLinkingMiddleware,
};
To test this you can use this command:
adb shell am start -a android.intent.action.VIEW -d "test://lost-password/foo" de.your-package.id
from react-native-deep-linking.
Cmon...... if you're going to provide a 'react-native' library, then make sure the docs are updated for both platforms. Otherwise, mark it as [iOS Only]
from react-native-deep-linking.
Related Issues (20)
- Not working on android HOT 2
- 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.