Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async openLink() {
const { url, statusBarStyle } = this.state;
try {
if (await InAppBrowser.isAvailable()) {
// A delay to change the StatusBar when the browser is opened
const animated = true;
const delay = animated && Platform.OS === 'ios' ? 400 : 0;
setTimeout(() => StatusBar.setBarStyle('light-content'), delay);
const result = await InAppBrowser.open(url, {
// iOS Properties
dismissButtonStyle: 'cancel',
preferredBarTintColor: '#453AA4',
preferredControlTintColor: 'white',
readerMode: false,
animated,
modalPresentationStyle: 'fullScreen',
modalTransitionStyle: 'partialCurl',
modalEnabled: true,
enableBarCollapsing: false,
// Android Properties
showTitle: true,
toolbarColor: '#6200EE',
secondaryToolbarColor: 'black',
enableUrlBarHiding: true,
enableDefaultShare: true,