withDeepLinking.js
1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { createDeepLinkingHandler } from 'react-native-deep-link';
import { NavigationActions } from 'react-navigation';
let navigator;
export const setTopLevelNavigator = navigatorRef => {
navigator = navigatorRef;
};
export const navigate = ({ routeName, params }) => {
navigator.dispatch(
NavigationActions.navigate({ routeName, params })
);
};
const handleColorScreenDeepLink = ({ params: { color }, query: { textColor } }) => () => {
console.log("A")
navigate({
routeName: 'MyCoupon',
params: {
color,
textColor
}
});
};
const config= [
{
name: 'https:',
routes: [
{
expression: 'sanggatalk.page.link/app/coupon/:id',
callback: handleColorScreenDeepLink
},
{
expression: 'sanggatalk.page.link/app/stamp/:id',
callback: handleColorScreenDeepLink
}
]
}
]
export default createDeepLinkingHandler(config);