Skip to content
This repository has been archived by the owner on Nov 10, 2020. It is now read-only.

initialize

Matei Radu edited this page Mar 3, 2019 · 3 revisions

⚠️ This function is deprecated since release 1.4.0.

If you're still using this function, check Migrating from 1.x to 2.x in preparation for the next major release expected for June 2019.

initialize(settings)

Parameters

  • settings: A Settings object with settings for each platform.

Return

undefined

Description

initialize will apply the provided settings for all new InAppBrowser.open(url [, settings]) invocations.

This method comes in useful when you have consistent settings across most of your usages so you don't have to pass settings each time you invoke open.

Settings provided to open have priority over the ones set with initialize and will effectively perform a merge between them.

Example

import { InAppBrowser, initialize } from "@matt-block/react-native-in-app-browser";

// Somewhere in your app initialization logic.
initialize({
  android: {
    toolbarColor: "red",
    showTitle: true
  }
});

// Other part of your code base.
// Merged settings for this call will result in:
//
// - toolbarColor: "blue",
// - showTitle: true
InAppBrowser.open("https://www.wikipedia.org/", {
  android: {
    toolbarColor: "blue"
  }
});