'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)
}
}
I was wondering if any of you know this error or if there is a working alternative?
Solution 1:[1]
There is a solution which i found few weeks ago here: How To Add A In-App Browser In React-Native
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dharman |
Solution 2 | Tim Knapp |