UNPKG

@gathertown/uikit-react-native

Version:

Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.

35 lines 888 B
import { Image, Linking, Platform } from 'react-native'; import { Logger } from '@gathertown/uikit-utils'; export default class SBUUtils { static openSettings() { Linking.openSettings().catch(() => { if (Platform.OS === 'ios') Linking.openURL('App-Prefs:root'); }); } static async openURL(url) { try { const targetUrl = url.startsWith('http') ? url : 'https://' + url; await Linking.openURL(targetUrl); } catch (e) { Logger.warn('Cannot open url', e); } } static getImageSize(uri) { return new Promise((resolve, reject) => { Image.getSize(uri, (width, height) => { resolve({ width, height }); }, error => { reject(error); }); }); } static async safeRun(callback) { try { await callback(); } catch (e) {} } } //# sourceMappingURL=SBUUtils.js.map