import { Linking, Platform } from 'react-native'; // import SafariView from 'react-native-safari-view'; let SafariView={}; export class WebBrowserService { static openBrowserAsync = (url: string): Promise => { if (Platform.OS === 'ios') { return WebBrowserService.openInAppUrl(url).catch(() => WebBrowserService.openUrl(url)); } else { return WebBrowserService.openUrl(url); } }; private static openInAppUrl = (url: string): Promise => { return SafariView.isAvailable() .then(() => SafariView.show({ url })); }; private static openUrl = (url: string): Promise => { return Linking.openURL(url); }; }