Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rescript-react-native/inappbrowser
ReScript bindings for react-native-inappbrowser-reborn
https://github.com/rescript-react-native/inappbrowser
in-app-browser inappbrowser react react-native rescript rescript-react rescript-react-native
Last synced: 5 days ago
JSON representation
ReScript bindings for react-native-inappbrowser-reborn
- Host: GitHub
- URL: https://github.com/rescript-react-native/inappbrowser
- Owner: rescript-react-native
- License: mit
- Created: 2021-01-07T08:54:19.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-04-22T06:58:04.000Z (over 1 year ago)
- Last Synced: 2024-12-09T20:46:18.714Z (24 days ago)
- Topics: in-app-browser, inappbrowser, react, react-native, rescript, rescript-react, rescript-react-native
- Language: ReScript
- Homepage:
- Size: 123 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `@rescript-react-native/inappbrowser`
[![Build Status](https://github.com/rescript-react-native/inappbrowser/workflows/Build/badge.svg)](https://github.com/rescript-react-native/inappbrowser/actions)
[![Version](https://img.shields.io/npm/v/@rescript-react-native/inappbrowser.svg)](https://www.npmjs.com/@rescript-react-native/inappbrowser)
[![ReScript Forum](https://img.shields.io/discourse/posts?color=e6484f&label=ReScript%20Forum&server=https%3A%2F%2Fforum.rescript-lang.org)](https://forum.rescript-lang.org/)[ReScript](https://rescript-lang.org) bindings for
[`react-native-inappbrowser-reborn`](https://github.com/proyecto26/react-native-inappbrowser).Exposed as `ReactNativeInAppBrowser` module.
`@rescript-react-native/inappbrowser` X.y.\* means it's compatible with
`react-native-inappbrowser-reborn` X.y.\*## Installation
When
[`react-native-inappbrowser-reborn`](https://github.com/proyecto26/react-native-inappbrowser)
is properly installed & configured by following their installation instructions,
you can install the bindings:```console
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`:```diff
{
//...
"bs-dependencies": [
"@rescript/react",
"rescript-react-native",
// ...
+ "@rescript-react-native/inappbrowser"
],
//...
}
```## Usage
```rescript
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;
``````rescript
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;
```### Types
#### `authResult`
#### `browserResult`
#### `iosOptions`
#### `androidOptions`
### Methods
#### `ReactNativeInAppBrowser.openBrowser`
```rescript
(string, [ `AndroidOptions(androidOptions) | `IosOptions(iosOptions) ]) => Js.Promise.t(browserResult)
```#### `ReactNativeInAppBrowser.close`
```rescript
unit => unit
```#### `ReactNativeInAppBrowser.openAuth`
```rescript
(string, [ `AndroidOptions(androidOptions) | `IosOptions(iosOptions) ]) => Js.Promise.t(authResult)
```#### `ReactNativeInAppBrowser.closeAuth`
```rescript
unit => unit
```---
## Changelog
Check the [changelog](./CHANGELOG.md) for more informations about recent
releases.---
## Contribute
Read the
[contribution guidelines](https://github.com/rescript-react-native/.github/blob/master/CONTRIBUTING.md)
before contributing.## Code of Conduct
We want this community to be friendly and respectful to each other. Please read
[our full code of conduct](https://github.com/rescript-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
so that you can understand what actions will and will not be tolerated.