Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to open a link to a nonexistent page (expo sdk 50) #246

Open
goldfishdevs opened this issue Jul 30, 2024 · 7 comments
Open
Labels
bug Something isn't working

Comments

@goldfishdevs
Copy link

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

Screenshot 2024-07-30 at 08 46 29 Screenshot 2024-07-30 at 08 46 52

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
IMG_4603

@goldfishdevs goldfishdevs added the bug Something isn't working label Jul 30, 2024
@goldfishdevs
Copy link
Author

Any help please ?

@NicolasRecomiendApp
Copy link

Hi @goldfishdevs, are you using expo router?

@goldfishdevs
Copy link
Author

Yes. i am using it

@NicolasRecomiendApp
Copy link

NicolasRecomiendApp commented Sep 26, 2024

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);
    }
    

@goldfishdevs
Copy link
Author

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.

@NicolasRecomiendApp
Copy link

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"
}
],
]

@goldfishdevs
Copy link
Author

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" } ], ]
Screenshot 2024-10-08 at 14 05 45
Yes, I have configured it in the app.config.json file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants