react-native-inappbrowser
react-native-inappbrowser copied to clipboard
react-native-inappbrowser IOS issue
Which platform(s) does your issue occur on?
- emulator
Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
-While opening inapp browser it shows an error "Another inappbrowser is already being presented" -Works fine when you refresh your code (every time)
According to the prev discussion, this issue could be triggered by this code modalTransitionStyle: partialCurl
.
Rebuild the project, and it's gone.
According to the prev discussion, this issue could be triggered by this code
modalTransitionStyle: partialCurl
. Rebuild the project, and it's gone.
Code: const openLink = async () => { try { const isAvailable: any = await InAppBrowser.isAvailable(); const url = "https://www.google.com";
if (isAvailable) {
const result: any = await InAppBrowser.open(url, {
// iOS Properties
dismissButtonStyle: "cancel",
preferredBarTintColor: "#453AA4",
preferredControlTintColor: "white",
readerMode: false,
animated: true,
modalPresentationStyle: "fullScreen",
modalTransitionStyle: "partialCurl",
modalEnabled: true,
enableBarCollapsing: false,
// Specify full animation resource identifier(package:anim/name)
// or only resource name(in case of animation bundled with app).
animations: {
startEnter: "slide_in_right",
startExit: "slide_out_left",
endEnter: "slide_in_left",
endExit: "slide_out_right",
},
headers: {
"my-custom-header": "my custom header value",
},
});
await sleep(800);
Alert.alert(JSON.stringify(result));
} else Linking.openURL(url);
} catch (error: any) {
Alert.alert(error.message);
}
};
Still getting same error
@shaheerarshad757 Were you able to solve this issue? I get the same error and behaviour as you have.
this happened with me when I tried modalTransitionStyle: partialCurl
just rebuild your project npm start -- --reset-cache
I fixed this with the hack recommended issue 131. It's not great but does seem to work. For the record, I got it working without the catch but I added it to be safe.
if (await InAppBrowser.isAvailable()) {
try {
InAppBrowser.close() // close any left over InAppBrowsers
InAppBrowser.open(THE_URL, config)
} catch (e) {
InAppBrowser.close()
InAppBrowser.open(THE_URL, config)
}
}