React Navigation Deep link not navigate

138 views Asked by At

I'm working on a React native app, I want to navigate the user using a deep link with react-navigation to the forgot password page. Below is the redirect link on which I wan to navigate myapp://updatapassword/#access_token=e&expires_at=1695801919&expires_in=86400&refresh_token=I&token_type=bearer&type=recover

I have tried this code but it won't work for me:

const config = {
    screens: {
        Login: {
            path: "login",
        },
        ForgotPassword: {
            path: "updatepassword/:access_token/:expires_at/:expires_in/:refresh_token/:token_type/:type",
            parse: {
                access_token: (access_token: string) => access_token,
                expires_at: (expires_at: Number) => expires_at,
                expires_in: (expires_in: Number) => expires_in,
                refresh_token: (refresh_token: string) => refresh_token,
                token_type: (token_type: string) => token_type,
                type: (type: string) => type,
            },
        },
        getStateFromPath(path: string, options) {
            console.log(path);
            let updatePath = path.replaceAll("#", "&");
            let accessiblePath = updatePath.replaceAll("&", "/");

            return getStateFromPath(accessiblePath, options);
        },
    },
};

And in this way I'm testing my deeplinkg: adb shell am start -W -a android.intent.action.VIEW -d "myapp://updatepassword/#access_token=e&expires_at=1695801919&expires_in=86400&refresh_token=I&token_type=bearer&type=signup" com.myapp

0

There are 0 answers