Skip to content

Unable to close Browser after timeout (Android) #135

Closed
@meghna1711

Description

@meghna1711

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'));
  }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions