UNPKG

@swan-io/react-native-browser

Version:

An easy-to-use in-app browser module for React Native.

36 lines (35 loc) 945 B
"use strict"; import { processColor } from "react-native"; import NativeModule from "./specs/NativeRNSwanBrowser"; const convertColorToNumber = color => { const processed = processColor(color); if (typeof processed === "number") { return processed; } }; export const openBrowser = (url, options = {}) => { const { animationType, dismissButtonStyle } = options; const barTintColor = convertColorToNumber(options.barTintColor); const controlTintColor = convertColorToNumber(options.controlTintColor); return NativeModule.open(url, { ...(animationType != null && { animationType }), ...(dismissButtonStyle != null && { dismissButtonStyle }), ...(barTintColor != null && { barTintColor }), ...(controlTintColor != null && { controlTintColor }) }).then(() => {}); }; export const closeBrowser = () => { NativeModule.close(); }; //# sourceMappingURL=index.js.map