proyecto26 / react-native-inappbrowser

📱InAppBrowser for React Native (Android & iOS) 🤘
https://www.npmjs.com/package/react-native-inappbrowser-reborn
MIT License
1.31k stars 224 forks source link

null is not an object (evaluating '_utils.RNInAppBrowser.isAvailable')] #299

Closed khlimmm closed 2 years ago

khlimmm commented 3 years ago

My code as below:

const buyNowHandler = async () => {
    try {
      const isAvailable = await InAppBrowser.isAvailable();
      console.log(isAvailable);
      const url = "https://google.com";
      if (isAvailable) {
        await InAppBrowser.open(url, {
          // iOS Properties
          dismissButtonStyle: "cancel",
          preferredBarTintColor: "gray",
          preferredControlTintColor: "white",
          // Android Properties
          showTitle: true,
          toolbarColor: "#6200EE",
          secondaryToolbarColor: "black",
          enableUrlBarHiding: true,
          enableDefaultShare: true,
          forceCloseOnRedirection: true,
        });
      }
    } catch (error) {
      throw error;
    }

I am getting the following error:

TypeError: null is not an object (evaluating '_utils.RNInAppBrowser.isAvailable')

My react native version is 0.63.2 and testing device is physical iOS device and using Expo.

jdnichollsc commented 2 years ago

You can't use native plugins with Expo, please eject your code or use this other expo package instead 👍 https://github.com/expo/expo/tree/master/packages/expo-web-browser

prasad-11-cairs commented 2 years ago

I not using Expo and testing on simulator and emulator facing the same problem

jdnichollsc commented 2 years ago

Please attach a repository of your project, this issue happens when the plugin is not linked correctly :)