Closed Adnan-Bacic closed 2 years ago
Try adding a delay before showing the alert, something like this:
async sleep(timeout: number) {
return new Promise(resolve => setTimeout(resolve, timeout));
}
async openLink() {
try {
const url = 'test'
if (await InAppBrowser.isAvailable()) {
const result = await InAppBrowser.open(url);
await this.sleep(800);
Alert.alert(JSON.stringify(result))
}
else Linking.openURL(url)
} catch (error) {
Alert.alert(error.message)
console.log('post alert')
}
During my tests I found race conditions like this scenario with these native components, please try and let me know! 👍
Which platform(s) does your issue occur on?
Please, provide the following version numbers that your issue occurs with:
react-native --version
to fetch it) 6.0.1 im on react-native 0.67.1package.json
file of your project and paste your dependencies and devDependencies here) 3.5.1 edit: just tried updating to current version of 3.6.3, and it still happens.Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.
SOMETIMES it alerts, but rarely, and then it only does it once. after it has been dismissed it wont appear again.
alerts works fine otherwise.
Is there any code involved?
this is basically just the code from the example, i just removed all the options and put an invalid url: