1- ## How to use this template
2-
3- - ⚠️ ** Don't fork this repository.** Use the "Use this template" green GitHub
4- button.
5- - Put your bindings in ` src/ReactNativeXxxxxxxxxx ` & rename accordingly or use
6- ` bsconfig.json ` ` "namespace" ` field (more on this below),
7- - Update all occurences of
8-
9- - ` @reason-react-native/__template__ `
10- - ` https://github.com/reason-react-native/__template__ `
11- - ` __template__ `
12- - ` react-native-XXXXXXXXXX `
13- - ` https://github.com/OWNER/react-native-XXXXXXXXXX `
14- - ` ReactNativeXxxxxxxxxx ` . If you have more than a file exposed, you should
15- consider using ReScript custom namespace by adjusting ` bsconfig.json `
16- and adding a ` "namespace": "react-native-something" ` (note that it will be
17- converted to ` ReactNativeXxxxxxxxxx ` )
18-
19- - Add your ` react-native-XXXXXXXXXX ` (adjusted) in ` peerDependencies `
20- & ` devDependencies ` section
21- - Adjust the changelog (and/or clean it)
22- - Remove this part ⬆ & keep everything below ⬇
1+ # ` @reason-react-native/inappbrowser `
232
24- ---
25-
26- # ` @reason-react-native/__template__ `
27-
28- [ ![ Build Status] ( https://github.com/reason-react-native/__template__/workflows/Build/badge.svg )] ( https://github.com/reason-react-native/__template__/actions )
29- [ ![ Version] ( https://img.shields.io/npm/v/@reason-react-native/__template__.svg )] ( https://www.npmjs.com/@reason-react-native/__template__ )
303[ ![ Chat] ( https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue )] ( https://reason-react-native.github.io/discord/ )
314
325[ ReScript] ( https://rescript-lang.org ) / [ Reason] ( https://reasonml.github.io ) bindings for
33- [ ` react-native-XXXXXXXXXX ` ] ( https://github.com/OWNER /react-native-XXXXXXXXXX ) .
6+ [ ` react-native-inappbrowser-reborn ` ] ( https://github.com/proyecto26 /react-native-inappbrowser ) .
347
35- Exposed as ` ReactNativeXxxxxxxxxx ` module.
8+ Exposed as ` ReactNativeInAppBrowser ` module.
369
37- ` @reason-react-native/__template__ ` X.y.\* means it's compatible with
38- ` react-native-XXXXXXXXXX ` X.y.\*
10+ ` @reason-react-native/inappbrowser ` X.y.\* means it's compatible with
11+ ` react-native-inappbrowser-reborn ` X.y.\*
3912
4013## Installation
4114
4215When
43- [ ` react-native-XXXXXXXXXX ` ] ( https://github.com/OWNER /react-native-XXXXXXXXXX )
16+ [ ` react-native-inappbrowser-reborn ` ] ( https://github.com/proyecto26 /react-native-inappbrowser )
4417is properly installed & configured by following their installation instructions,
4518you can install the bindings:
4619
4720``` console
48- npm install @reason-react-native/__template__
21+ npm install @reason-react-native/inappbrowser
4922# or
50- yarn add @reason-react-native/__template__
23+ yarn add @reason-react-native/inappbrowser
5124```
5225
53- ` @reason-react-native/__template__ ` should be added to ` bs-dependencies ` in your
26+ ` @reason-react-native/inappbrowser ` should be added to ` bs-dependencies ` in your
5427` bsconfig.json ` :
5528
5629``` diff
@@ -60,23 +33,51 @@ yarn add @reason-react-native/__template__
6033 "reason-react",
6134 "reason-react-native",
6235 // ...
63- + "@reason-react-native/__template__ "
36+ + "@reason-react-native/inappbrowser "
6437 ],
6538 //...
6639}
6740```
6841
6942## Usage
7043
44+ ### Examples
45+
46+ ``` reason
47+ open Js.Promise;
48+
49+ let opts = iosOptions(~preferredBarTintColor="#ff0000", ());
50+ openBrowserIos("https://rescript-lang.org", opts)
51+ |> Js.Promise.then_((result: browserResult) => {
52+ Js.log(result.resultType);
53+ resolve();
54+ })
55+ |> ignore;
56+ ```
57+
58+ ``` reason
59+ open Js.Promise;
60+
61+ openAuthIos("https://example.com/auth", "myschema://auth", iosOptions())
62+ |> Js.Promise.then_((result: authResult) => {
63+ switch (result.url) {
64+ | Some(url) => Js.log(url)
65+ | None => Js.log("Something went wrong")
66+ };
67+ resolve();
68+ })
69+ |> ignore;
70+ ```
71+
7172### Types
7273
73- #### ` ReactNativeXxxxxxxxxx .t`
74+ #### ` ReactNativeInAppBrowser .t`
7475
7576...
7677
7778### Methods
7879
79- #### ` ReactNativeXxxxxxxxxx .method`
80+ #### ` ReactNativeInAppBrowser .method`
8081
8182...
8283
0 commit comments