Skip to content

Commit bbc1400

Browse files
committed
ReScript
1 parent ef28914 commit bbc1400

File tree

10 files changed

+135
-151
lines changed

10 files changed

+135
-151
lines changed

.gitattributes

Lines changed: 0 additions & 3 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ node_modules
99
# npm unused lock file (we use yarn.lock)
1010
package-lock.json
1111

12-
# ReScript / Reason / Ocaml artifacts
13-
#*.bs.js # we do want this files to ensure zero-cost
12+
# ReScript artifacts
13+
# *.bs.js # we do want this files to ensure zero-cost
1414
.bsb.lock
1515
**/lib/bs
1616
**/lib/ocaml

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Changelog of `@reason-react-native/inappbrowser`
1+
# Changelog of `@rescript-react-native/inappbrowser`
22

33
## 3.5.0 - 2021-01-07
44

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 @reason-react-native contributors
3+
Copyright (c) 2019 @rescript-react-native contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
# `@reason-react-native/inappbrowser`
1+
# `@rescript-react-native/inappbrowser`
22

3-
[![Chat](https://img.shields.io/discord/235176658175262720.svg?logo=discord&colorb=blue)](https://reason-react-native.github.io/discord/)
3+
[![Build Status](https://github.com/rescript-react-native/inappbrowser/workflows/Build/badge.svg)](https://github.com/rescript-react-native/inappbrowser/actions)
4+
[![Version](https://img.shields.io/npm/v/@rescript-react-native/inappbrowser.svg)](https://www.npmjs.com/@rescript-react-native/inappbrowser)
5+
[![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/)
46

5-
[ReScript](https://rescript-lang.org) / [Reason](https://reasonml.github.io) bindings for
7+
[ReScript](https://rescript-lang.org) bindings for
68
[`react-native-inappbrowser-reborn`](https://github.com/proyecto26/react-native-inappbrowser).
79

810
Exposed as `ReactNativeInAppBrowser` module.
911

10-
`@reason-react-native/inappbrowser` X.y.\* means it's compatible with
12+
`@rescript-react-native/inappbrowser` X.y.\* means it's compatible with
1113
`react-native-inappbrowser-reborn` X.y.\*
1214

1315
## Installation
@@ -18,30 +20,30 @@ is properly installed & configured by following their installation instructions,
1820
you can install the bindings:
1921

2022
```console
21-
npm install @reason-react-native/inappbrowser
23+
npm install @rescript-react-native/inappbrowser
2224
# or
23-
yarn add @reason-react-native/inappbrowser
25+
yarn add @rescript-react-native/inappbrowser
2426
```
2527

26-
`@reason-react-native/inappbrowser` should be added to `bs-dependencies` in your
28+
`@rescript-react-native/inappbrowser` should be added to `bs-dependencies` in your
2729
`bsconfig.json`:
2830

2931
```diff
3032
{
3133
//...
3234
"bs-dependencies": [
33-
"reason-react",
34-
"reason-react-native",
35+
"@rescript/react",
36+
"rescript-react-native",
3537
// ...
36-
+ "@reason-react-native/inappbrowser"
38+
+ "@rescript-react-native/inappbrowser"
3739
],
3840
//...
3941
}
4042
```
4143

4244
## Usage
4345

44-
```reason
46+
```rescript
4547
open Js.Promise;
4648
open ReactNativeInAppBrowser;
4749
@@ -54,7 +56,7 @@ openBrowser("https://rescript-lang.org", `IosOptions(opts))
5456
|> ignore;
5557
```
5658

57-
```reason
59+
```rescript
5860
open Js.Promise;
5961
open ReactNativeInAppBrowser;
6062
@@ -83,25 +85,25 @@ openAuthIos("https://example.com/auth", "myschema://auth", `IosOptions(iosOption
8385

8486
#### `ReactNativeInAppBrowser.openBrowser`
8587

86-
```reason
88+
```rescript
8789
(string, [ `AndroidOptions(androidOptions) | `IosOptions(iosOptions) ]) => Js.Promise.t(browserResult)
8890
```
8991

9092
#### `ReactNativeInAppBrowser.close`
9193

92-
```reason
94+
```rescript
9395
unit => unit
9496
```
9597

9698
#### `ReactNativeInAppBrowser.openAuth`
9799

98-
```reason
100+
```rescript
99101
(string, [ `AndroidOptions(androidOptions) | `IosOptions(iosOptions) ]) => Js.Promise.t(authResult)
100102
```
101103

102104
#### `ReactNativeInAppBrowser.closeAuth`
103105

104-
```reason
106+
```rescript
105107
unit => unit
106108
```
107109

@@ -117,11 +119,11 @@ releases.
117119
## Contribute
118120

119121
Read the
120-
[contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md)
122+
[contribution guidelines](https://github.com/rescript-react-native/.github/blob/master/CONTRIBUTING.md)
121123
before contributing.
122124

123125
## Code of Conduct
124126

125127
We want this community to be friendly and respectful to each other. Please read
126-
[our full code of conduct](https://github.com/reason-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
128+
[our full code of conduct](https://github.com/rescript-react-native/.github/blob/master/CODE_OF_CONDUCT.md)
127129
so that you can understand what actions will and will not be tolerated.

bsconfig.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"name": "@reason-react-native/inappbrowser",
3-
"refmt": 3,
4-
"reason": {
5-
"react-jsx": 3
6-
},
2+
"name": "@rescript-react-native/inappbrowser",
3+
"reason": { "react-jsx": 3 },
74
"package-specs": {
85
"module": "commonjs",
96
"in-source": true

package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@reason-react-native/inappbrowser",
2+
"name": "@rescript-react-native/inappbrowser",
33
"description": "ReScript bindings for react-native-inappbrowser",
44
"version": "3.5.0",
55
"publishConfig": {
@@ -12,15 +12,13 @@
1212
"license": "MIT",
1313
"keywords": [
1414
"rescript",
15-
"reason",
16-
"reasonml",
17-
"bucklescript",
1815
"react-native"
1916
],
2017
"files": [
2118
"*.md",
2219
"bsconfig.json",
23-
"src/**/*.re",
20+
"src/**/*.res",
21+
"src/**/*.resi",
2422
"src/**/*.js",
2523
"!src/**/*.bs.js"
2624
],
@@ -37,7 +35,7 @@
3735
"release": "npmpub"
3836
},
3937
"devDependencies": {
40-
"bs-platform": "^8.2.0",
38+
"bs-platform": "^9.0.0",
4139
"husky": "^4.0.0",
4240
"lint-staged": "^10.0.0",
4341
"npmpub": "^5.0.0",

src/ReactNativeInAppBrowser.re

Lines changed: 0 additions & 111 deletions
This file was deleted.

src/ReactNativeInAppBrowser.res

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
type authResult = {
2+
@as("type")
3+
resultType: [#cancel | #dismiss | #success],
4+
url: option<string>,
5+
}
6+
7+
type browserResult = {
8+
@as("type")
9+
resultType: [#cancel | #dismiss],
10+
}
11+
12+
type iosOptions
13+
@obj
14+
external iosOptions: (
15+
~dismissButtonStyle: @string
16+
[
17+
| @as("done") #doneButton
18+
| @as("close") #closeButton
19+
| @as("cancel") #cancelButton
20+
]=?,
21+
~preferredBarTintColor: string=?,
22+
~preferredControlTintColor: string=?,
23+
~readerMode: bool=?,
24+
~animated: bool=?,
25+
~modalPresentationStyle: [
26+
| #automatic
27+
| #fullScreen
28+
| #pageSheet
29+
| #formSheet
30+
| #currentContext
31+
| #custom
32+
| #overFullScreen
33+
| #overCurrentContext
34+
| #popover
35+
| #none
36+
]=?,
37+
~modalTransitionStyle: [
38+
| #coverVertical
39+
| #flipHorizontal
40+
| #crossDissolve
41+
| #partialCurl
42+
]=?,
43+
~modalEnabled: bool=?,
44+
~enableBarCollapsing: bool=?,
45+
~ephemeralWebSession: bool=?,
46+
unit,
47+
) => iosOptions = ""
48+
49+
type androidAnimationOptions = {
50+
startEnter: string,
51+
startExit: string,
52+
endEnter: string,
53+
endExit: string,
54+
}
55+
56+
type androidOptions
57+
@obj
58+
external androidOptions: (
59+
~showTitle: bool=?,
60+
~toolbarColor: string=?,
61+
~secondaryToolbarColor: string=?,
62+
~enableUrlBarHiding: bool=?,
63+
~enableDefaultShare: bool=?,
64+
~forceCloseOnRedirection: bool=?,
65+
~animations: androidAnimationOptions=?,
66+
~headers: Js.t<'a>=?,
67+
~hasBackButton: bool=?,
68+
~browserPackage: string=?,
69+
~showInRecents: bool=?,
70+
unit,
71+
) => androidOptions = ""
72+
73+
@module("react-native-inappbrowser-reborn") @scope("InAppBrowser")
74+
external isAvailable: unit => Js.Promise.t<bool> = "isAvailable"
75+
76+
@module("react-native-inappbrowser-reborn") @scope("InAppBrowser")
77+
external openBrowser: (
78+
string,
79+
@unwrap
80+
[
81+
| #IosOptions(iosOptions)
82+
| #AndroidOptions(androidOptions)
83+
],
84+
) => Js.Promise.t<browserResult> = "open"
85+
86+
@module("react-native-inappbrowser-reborn") @scope("InAppBrowser")
87+
external close: unit => unit = "close"
88+
89+
@module("react-native-inappbrowser-reborn") @scope("InAppBrowser")
90+
external openAuth: (
91+
string,
92+
string,
93+
@unwrap
94+
[
95+
| #IosOptions(iosOptions)
96+
| #AndroidOptions(androidOptions)
97+
],
98+
) => Js.Promise.t<authResult> = "openAuth"
99+
100+
@module("react-native-inappbrowser-reborn") @scope("InAppBrowser")
101+
external closeAuth: unit => unit = "closeAuth"

0 commit comments

Comments
 (0)