-
Couldn't load subscription status.
- Fork 5
InAppBrowser
Since release 1.4.0, importing InAppBrowser is the main way of consuming the library's API.
If you're still using the now deprecated functions, check Migrating from 1.x to 2.x in preparation for the next major release expected for June 2019.
-
url: a valid HTTP or HTTPS url. -
settings: Optional. ASettingsobject with settings for each platform.
A Promise that is rejected if url is not a valid HTTP or HTTPS url.
open will, as you might expect, open the given url in the platform-appropriate in-app browser with the given settings applied (if any).
Settings provided to open do not persist across multiple invocations and are valid only for each single instance. However, these settings will be applied on top of any global settings configured via InAppBrowser.configure(settings).
import { InAppBrowser } from "@matt-block/react-native-in-app-browser";
// Only url.
InAppBrowser.open("https://www.wikipedia.org/").catch(error => {
console.log(error);
});
// With platform-specific optional settings.
InAppBrowser.open("https://www.wikipedia.org/", {
android: {
//...,
},
ios: {
//...,
},
}).catch(error => {
console.log(error);
});
// Using async/await.
async onClickHandler() {
try {
await InAppBrowser.open("https://www.wikipedia.org/");
} catch (error) {
console.log(error);
}
}