Closed
Description
I have a use case wherein I have to close the in-app browser after a timeout, however, this is not working in android. This works fine in iOS though. Find below the code snippet used.
Versions used:
react-native: 0.58.6
react-native-inappbrowser: 1.3.13
node: 10.15.1
export const onLogout = async (_url: string) => {
const deepLink = getDeepLink('identity');
try {
await InAppBrowser.isAvailable();
const authPromise = InAppBrowser.openAuth(_url, deepLink, {
// iOS Properties
dismissButtonStyle: 'cancel',
animated: false,
modalPresentationStyle: 'overFullScreen',
modalTransitionStyle: 'partialCurl',
modalEnabled: true,
enableBarCollapsing: false,
// Android Properties
showTitle: false,
enableUrlBarHiding: true,
enableDefaultShare: true,
});
setTimeout(() => {
InAppBrowser.closeAuth();
}, 4500);
return authPromise.then((response) => {
console.info('Link closed', response);
return {};
});
} catch (e) {
return Promise.reject(new Error('Unable to open link'));
}
};