Skip to content

Getting redirected to 'appscheme://userProfile' screen after getting back to the app #7

Description

@rafi-shaik

First of all, thank you for creating an npm package which makes life easier. So I'm using this in an Expo app for iOS. Everything seems fine. The user is redirected to Truecaller app from my app and a modal opens with user details and when the user clicks on continue, he's redirected back to the app. The issue arises here as soon as the user redirected back to my app from Truecaller, he is immediately to navigated to 'usertProfile' screen on Success. I want to use the user details after success instead this is getting me redirected to an unknown screen.

This is the code I use

import { useTruecaller } from "@kartikbhalla/react-native-truecaller";

const TruecallerButton = () => {
  const { initializeTruecaller, openTruecallerModal, user, error, errorCode } =
    useTruecaller({
      iosAppKey: process.env.EXPO_PUBLIC_TRUECALLER_APP_KEY,
      iosAppLink: process.env.EXPO_PUBLIC_TRUECALLER_APP_LINK,
    });

  useEffect(() => {
    if (user) {
      console.log('user details", user);
    }
  }, [user]);

  useEffect(() => {
    if (error) {
      console.log("error at Truecaller", error);
    }
  }, [error]);

  useEffect(() => {
    initializeTruecaller();

    const handleDeepLink = ({ url }: { url: string }) => {
      console.log("Incoming deep link:", url);
    };

    const subscription = Linking.addEventListener("url", handleDeepLink);
    return () => {
      subscription.remove();
    };
  }, [user]);

  return (
    <TouchableOpacity onPress={openTruecallerModal} style={styles.button}>
      <Image
        source={require("../assets/images/tuecaller.png")}
        style={styles.appIcon}
      />
      <Text style={styles.buttonText}>Continue with Truecaller</Text>
    </TouchableOpacity>
  );
};

The deeplink url is logged something like this in the console

Incoming deep link: https://randomstring.truecallerdevs.com/userProfile?response=........AAAAAAAAAAA3Y%3D

These are the package versions used

"expo": "~52.0.42",
 "react": "18.3.1",
 "react-dom": "18.3.1",
 "react-native": "0.76.9",
"@kartikbhalla/react-native-truecaller": "^0.2.0",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions