@matt-block/react-native-in-app-browser
Version:
React Native in-app browser
63 lines (62 loc) • 2.16 kB
TypeScript
/**
* Copyright (c) 2018-2020, Matei Bogdan Radu <opensource@mateiradu.dev>
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*/
import { initialize, Settings } from './settings';
/**
* In-app browser functionalities.
*/
declare class InAppBrowser {
/**
* Open a URL in app.
*
* @param {string} url http(s) URL to open.
* @param {Object} settings platform-specific settings for the in-app
* browsers.
*
* @throws If the `url` is not a valid http(s) URL.
*/
static open(url: string, settings?: Settings): Promise<void>;
/**
* Close the current in app browser instance.
*
* This feature is iOS only as Chrome Custom Tabs does not support
* programmatic dismissal.
*/
static close(): void;
/**
* Warm up the browser process.
*
* Allows the browser application to pre-initialize itself in the background.
* Significantly speeds up URL opening in the browser. This is asynchronous
* and can be called several times.
*
* This feature is Android only.
*/
static warmup(): Promise<boolean>;
/**
* Tell the browser of a likely future navigation to a URL.
*
* The method `warmup()` has to be called beforehand.
*
* Optionally, a list of other likely URLs can be provided. They are treated
* as less likely than the first one, and have to be sorted in decreasing
* priority order. These additional URLs may be ignored.All previous calls to
* this method will be deprioritized.
*
* This feature is Android only.
*/
static mayLaunchUrl(url: string, additionalUrls?: string[]): Promise<boolean>;
/**
* Configure the platform-specific settings for the in-app browser
* experience.
*
* This utility function is useful when `InAppBrowser.open` is used in several
* portions of the application code base as it allows to provide the
* settings only once instead of specifing them with each call.
*/
static configure: typeof initialize;
}
export { InAppBrowser };