ReScript bindings for
react-native-inappbrowser-reborn
.
Exposed as ReactNativeInAppBrowser
module.
@rescript-react-native/inappbrowser
X.y.* means it's compatible with
react-native-inappbrowser-reborn
X.y.*
When
react-native-inappbrowser-reborn
is properly installed & configured by following their installation instructions,
you can install the bindings:
npm install @rescript-react-native/inappbrowser
# or
yarn add @rescript-react-native/inappbrowser
@rescript-react-native/inappbrowser
should be added to bs-dependencies
in your
bsconfig.json
:
{
//...
"bs-dependencies": [
"@rescript/react",
"rescript-react-native",
// ...
+ "@rescript-react-native/inappbrowser"
],
//...
}
open Js.Promise;
open ReactNativeInAppBrowser;
let opts = iosOptions(~preferredBarTintColor="#ff0000", ());
openBrowser("https://rescript-lang.org", `IosOptions(opts))
|> Js.Promise.then_((result: browserResult) => {
Js.log(result.resultType);
resolve();
})
|> ignore;
open Js.Promise;
open ReactNativeInAppBrowser;
openAuthIos("https://example.com/auth", "myschema://auth", `IosOptions(iosOptions()))
|> Js.Promise.then_((result: authResult) => {
switch (result.url) {
| Some(url) => Js.log(url)
| None => Js.log("Something went wrong")
};
resolve();
})
|> ignore;
(string, [ `AndroidOptions(androidOptions) | `IosOptions(iosOptions) ]) => Js.Promise.t(browserResult)
unit => unit
(string, [ `AndroidOptions(androidOptions) | `IosOptions(iosOptions) ]) => Js.Promise.t(authResult)
unit => unit
Check the changelog for more informations about recent releases.
Read the contribution guidelines before contributing.
We want this community to be friendly and respectful to each other. Please read our full code of conduct so that you can understand what actions will and will not be tolerated.