Open goldfishdevs opened 3 months ago
Any help please ?
Hi @goldfishdevs, are you using expo router?
Yes. i am using it
So, then you don't have to handle anything for android, just configure the path to navigate directly to the concrete screen on branch platform -> /home -> it should do a navigation to your home screen.
In iOS you have to capture the link and then select the correct property to handle the navigation.
This is an example of what could you do on iOS
try {
if (Platform.OS === 'ios' && branch != undefined) {
branch?.subscribe(({ error, params }) => {
if (error) {
console.error('Error from Branch: ' + error);
return;
}
console.log('Arrives to branch');
// params will contain link data
console.log('Branch Params: ' + JSON.stringify(params));
console.log(params['$deeplink_path']);
const ruta = params['$deeplink_path']
?
params['$deeplink_path']
:
params['$ios_deeplink_path']
?
params['$ios_deeplink_path']
:
params['+non_branch_link'];
console.log('RUTA!!!', ruta);
if (ruta != undefined) {
//@ts-ignore
router.replace(ruta);
}
});
}
} catch (error) {
console.error('Erron on branch deeplink', error);
}
So, then you don't have to handle anything for android, just configure the path to navigate directly to the concrete screen on branch platform -> /home -> it should do a navigation to your home screen.
In iOS you have to capture the link and then select the correct property to handle the navigation.
This is an example of what could you do on iOS
try { if (Platform.OS === 'ios' && branch != undefined) { branch?.subscribe(({ error, params }) => { if (error) { console.error('Error from Branch: ' + error); return; } console.log('Arrives to branch'); // params will contain link data console.log('Branch Params: ' + JSON.stringify(params)); console.log(params['$deeplink_path']); const ruta = params['$deeplink_path'] ? params['$deeplink_path'] : params['$ios_deeplink_path'] ? params['$ios_deeplink_path'] : params['+non_branch_link']; console.log('RUTA!!!', ruta); if (ruta != undefined) { //@ts-ignore router.replace(ruta); } }); } } catch (error) { console.error('Erron on branch deeplink', error); }
My problem is that every time I open the app from the config link from branch.io, I always get to the not found page. I check and found current pathName "/ID_link_banch_IO". But if I link in the form "app://" there will be no error. so what I see you're talking about here is configured internally.
Have you correctly configured branch plugin on App.json? "plugins": [ [ "@config-plugins/react-native-branch", { "apiKey": "key_live_your_key_live_here", "iosAppDomain": "your_ios_app_domain" } ], ]
Have you correctly configured branch plugin on App.json? "plugins": [ [ "@config-plugins/react-native-branch", { "apiKey": "key_live_your_key_live_here", "iosAppDomain": "your_ios_app_domain" } ], ] Yes, I have configured it in the app.config.json file
Summary
I am trying to integrate my branch.io project with my react native expo project. I am using expo SDK 50 with @config-plugins/react-native-branch 6.0.0
When I click on a link, the app opens, but I don't know why it always goes to a nonexistent page. And i am using expo-router
Config Plugin
@config-plugins/react-native-branch
What platform(s) does this occur on?
Android, iOS
SDK Version
50.0.7
Reproducible demo
Those are the packages used in my package.json file
"expo": "^50.0.7", "react-native-branch": "6.0.0", "@config-plugins/react-native-branch": "7.0.0",
Page redirected when opening the app from the link