1

My app should open when the following deep link is executed: thekitty://pending-invitation/tokenhere

In order to do it, I followed the instructions from this lib https://github.com/luisfcofv/react-native-deep-linking

And the modifications to AppDelegate.m and AndroidManifest were done.

But the problem is that I'm not getting any event for the route pending-invitation/:token.

That's the hook that I made in order to handle with the deep linking logic:

/**
 * Handles the deep linking logic such as, registering URL schemas and
 * adding routes
 */
const useLinking = (): void => {
  const [_, setToken] = useJoinPendingInvitation();

  const registerSchemes = useCallback(() => {
    const schemes = Object.values(URL_SCHEMES);

    schemes.forEach((scheme) => {
      DeepLinking.addScheme(scheme);
    });
  }, []);

  const addRoutes = useCallback(() => {
    DeepLinking.addRoute(
      PENDING_INVITATION_LINK_ROUTE,
      (response: PendingInvitationRouteResponse) => {
        setToken(response.token);
      },
    );
  }, [setToken]);

  useEffect(() => {
    registerSchemes();

    addRoutes();
  }, [
    addRoutes,
    registerSchemes,
  ]);
};

export default useLinking;

The command that I'm executing to test it:

xcrun simctl openurl booted thekitty://fund-invitation/tokenhere

I'm registering the scheme - thekitty:// and adding the route on the component mount, so why the route handler isn't executed?

Laura Beatris
  • 1,782
  • 7
  • 29
  • 49

0 Answers0