Philipp Fischer
Philipp Fischer

Reputation: 225

Is there a React Native InAppBrowser that works with expo?

I am trying to use a in app browser in react native using expo and came across the react-native-inappbrowser-reborn package and I tried to use the given code example but always get this error when I alert it:

My code:

async function handleLink(link) {
 try {
  const url = link;
  if (await InAppBrowser.isAvailable()) {

  } else Linking.openURL(url); 
} catch (error) {
  alert(error.message)
}

}

enter image description here

I was wondering if any of you know this error or if there is a working alternative?

Upvotes: 2

Views: 5333

Answers (2)

Tim Knapp
Tim Knapp

Reputation: 106

This solution from expo works well for me:

import * as WebBrowser from 'expo-web-browser';

const openLink = WebBrowser.openBrowserAsync('https://google.com')

// JSX...

Here are the docs for expo-web-browser

Upvotes: 3

Shail Patel
Shail Patel

Reputation: 310

There is a solution which i found few weeks ago here: How To Add A In-App Browser In React-Native

Upvotes: 1

Related Questions