Skip to content

Commit 7be5d79

Browse files
committed
ReScript
1 parent b67ef20 commit 7be5d79

33 files changed

+553
-593
lines changed

.gitattributes

-3
This file was deleted.

.gitignore

+2-2
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

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Changelog of `@reason-react-native/webview`
1+
# Changelog of `@rescript-react-native/webview`
22

33
## 10.8.0 - 2020-11-20
44

55
- 10.8.0 compat
66
- rescript 8.2 required
7-
- reason-react-native 0.63 View props
7+
- rescript-react-native 0.63 View props
88

99
## 9.0.0 - 2020-03-19
1010

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 @reason-react-native
3+
Copyright (c) 2019 @rescript-react-native
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

+39-39
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# `@reason-react-native/webview`
1+
# `@rescript-react-native/webview`
22

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

7-
[ReScript](https://rescript-lang.org) / [Reason](https://reasonml.github.io) bindings for
7+
[ReScript](https://rescript-lang.org) bindings for
88
[`react-native-webview`](https://github.com/react-native-webview/react-native-webview).
99

1010
Exposed as the `ReactNativeWebView` module.
1111

12-
`@reason-react-native/webview` X.y.\* means it's compatible with
12+
`@rescript-react-native/webview` X.y.\* means it's compatible with
1313
`@react-native-community/react-native-webview` X.y.\*
1414

1515
## Installation
@@ -20,22 +20,22 @@ is properly installed & configured by following their installation instructions,
2020
you can install the bindings:
2121

2222
```console
23-
npm install @reason-react-native/webview
23+
npm install @rescript-react-native/webview
2424
# or
25-
yarn add @reason-react-native/webview
25+
yarn add @rescript-react-native/webview
2626
```
2727

28-
`@reason-react-native/webview` should be added to `bs-dependencies` in your
28+
`@rescript-react-native/webview` should be added to `bs-dependencies` in your
2929
`bsconfig.json`. For example,
3030

3131
```diff
3232
{
3333
//...
3434
"bs-dependencies": [
35-
"reason-react",
36-
"reason-react-native",
35+
"@rescript/react",
36+
"rescript-react-native",
3737
// ...
38-
+ "@reason-react-native/webview"
38+
+ "@rescript-react-native/webview"
3939
],
4040
//...
4141
}
@@ -63,7 +63,7 @@ Valid values are:
6363

6464
Values may be created using `DecelerationRate.value`
6565

66-
```reason
66+
```rescript
6767
value: float => t
6868
```
6969

@@ -88,7 +88,7 @@ Source to be loaded in the `WebView`, as specified by the [`source`(#source-sour
8888

8989
Creates a URI source
9090

91-
```reason
91+
```rescript
9292
uri:
9393
(
9494
~uri: string=?,
@@ -120,7 +120,7 @@ uri:
120120

121121
Creates a static HTML source
122122

123-
```reason
123+
```rescript
124124
html: (~html: string=?, ~baseUrl: string=?, unit) => t
125125
```
126126

@@ -131,15 +131,15 @@ html: (~html: string=?, ~baseUrl: string=?, unit) => t
131131

132132
Type of function passed to the [`onLoadEnd`](#onloadend-unioncallbackt) prop, to handle the union type [`webViewNavigationOrError`](#webviewnavigationorerror). Defined as
133133

134-
```reason
134+
```rescript
135135
ReactNative.Event.syntheticEvent(Js.t(webViewNavigationOrError)) => unit
136136
```
137137

138138
##### `UnionCallback.make`
139139

140140
Creates a function of type `UnionCallback.t`
141141

142-
```reason
142+
```rescript
143143
make:
144144
(
145145
~navigationCallback: WebViewNavigationEvent.t => unit,
@@ -152,7 +152,7 @@ make:
152152

153153
Creates a function of type `UnionCallback.t`
154154

155-
```reason
155+
```rescript
156156
uncurriedMake:
157157
(
158158
~navigationCallback:(. webViewNavigationEvent) => unit,
@@ -169,7 +169,7 @@ Represents a `WebView` instance, to be used with [methods](#methods).
169169

170170
Should be constructed as below:
171171

172-
```reason
172+
```rescript
173173
nativeConfig:
174174
(
175175
~component: React.component('a)=?,
@@ -185,7 +185,7 @@ You may refer to [iOS↗](https://github.com/react-native-webview/react-native-w
185185

186186
React `ref` intended to access a `WebView` instance. Defined as
187187

188-
```reason
188+
```rescript
189189
type ref = React.Ref.t(Js.nullable(element))
190190
```
191191

@@ -287,7 +287,7 @@ Has the below keys, which can be accessed with `##`.
287287

288288
wraps [`Js.t(webViewError)`](#jstwebviewerror) in `ReactNative.Event.syntheticEvent`
289289

290-
```reason
290+
```rescript
291291
type WebViewErrorEvent.t =
292292
ReactNative.Event.syntheticEvent(Js.t(webViewError));
293293
```
@@ -298,7 +298,7 @@ passed to the handler specified for [`onError`](#onerror-webviewerrorevent--unit
298298

299299
wraps [`Js.t(webViewHttpError)`](#jstwebviewhttperror) in `ReactNative.Event.syntheticEvent`
300300

301-
```reason
301+
```rescript
302302
type WebViewHttpErrorEvent.t =
303303
ReactNative.Event.syntheticEvent(Js.t(webViewHttpError));
304304
```
@@ -309,7 +309,7 @@ passed to the handler specified for [`onHttpError`](#onhttperror-webviewhttperro
309309

310310
wraps [`Js.t(webViewMessage)`](#jstwebviewmessage) in `ReactNative.Event.syntheticEvent`
311311

312-
```reason
312+
```rescript
313313
type WebViewMessageEvent.t =
314314
ReactNative.Event.syntheticEvent(Js.t(webViewMessage));
315315
```
@@ -320,7 +320,7 @@ passed to the handler specified for [`onMessage`](#onmessage-webviewmessageevent
320320

321321
wraps [`Js.t(webViewNavigation)`](#jstwebviewnavigation) in `ReactNative.Event.syntheticEvent`
322322

323-
```reason
323+
```rescript
324324
type WebViewNavigationEvent.t =
325325
ReactNative.Event.syntheticEvent(Js.t(webViewNavigation));
326326
```
@@ -331,7 +331,7 @@ passed to handlers specified for [`onLoad`](#onload-webviewnavigationevent--unit
331331

332332
wraps [`Js.t(webViewNativeProgressEvent)`](#jstwebviewnativeprogressevent) in `ReactNative.Event.syntheticEvent`
333333

334-
```reason
334+
```rescript
335335
type WebViewProgressEvent.t =
336336
ReactNative.Event.syntheticEvent(Js.t(webViewNativeProgressEvent));
337337
```
@@ -342,7 +342,7 @@ passed to the handler specified for [`onLoadProgress`](#onloadprogress-webviewpr
342342

343343
wraps [`Js.t(webViewNativeEvent)`](#jstwebviewnativeevent) in `ReactNative.Event.syntheticEvent`
344344

345-
```reason
345+
```rescript
346346
type WebViewTerminatedEvent.t =
347347
ReactNative.Event.syntheticEvent(webViewNativeEvent);
348348
```
@@ -413,7 +413,7 @@ Specifies `string` value to append to the `User-Agent` header, will be overridde
413413

414414
For example when `applicationNameForUserAgent="DemoApp/1.1.0"` as below:
415415

416-
```reason
416+
```rescript
417417
<ReactNativeWebView
418418
source=ReactNativeWebView.Source.uri(~uri="https://facebook.github.io/react-native", ())
419419
applicationNameForUserAgent="DemoApp/1.1.0"
@@ -463,7 +463,7 @@ allows to customize the WebView container style. Please note that there are defa
463463

464464
#### `contentInset: ReactNative.View.edgeInsets`
465465

466-
Refer to [`reason-react-native` documentation on View](https://github.com/reason-react-native/reason-react-native/blob/master/src/components/View.md).
466+
Refer to [`rescript-react-native` documentation on View](https://github.com/rescript-react-native/rescript-react-native/blob/master/src/components/View.md).
467467

468468
#### `` contentInsetAdjustmentBehavior: [ | `never | `always | `automatic | `scrollableAxes] ``
469469

@@ -523,7 +523,7 @@ Specifies JavaScript that will be injected into the web page when loaded. The st
523523

524524
Example below passes`window.location` as a JSON object to be handled by the function passed to `onMessage`
525525

526-
```reason
526+
```rescript
527527
let injectedJavaScript = "(function() {
528528
window.ReactNativeWebView.postMessage(JSON.stringify(window.location));
529529
})();";
@@ -552,7 +552,7 @@ Specifies JavaScript that will be injected into the web page after the document
552552

553553
Example below passes`window.location` as a JSON object to be handled by the function passed to `onMessage`
554554

555-
```reason
555+
```rescript
556556
let injectedJavaScript = "(function() {
557557
window.ReactNativeWebView.postMessage(JSON.stringify(window.location));
558558
})();";
@@ -621,7 +621,7 @@ _iOS only_
621621

622622
Specifies function to be invoked when the WebView content process is terminated. The process may be terminated due to reasons such as running too long or using too many resources, however, once terminated a blank page is displayed and the `WebView` becomes unusable. Please refer to the [PR](https://github.com/react-native-webview/react-native-webview/pull/774) which added the functionality to allow handling this issue.
623623

624-
```reason
624+
```rescript
625625
<ReactNativeWebView
626626
source=ReactNativeWebView.Source.uri(~uri="https://facebook.github.io/react-native", ())
627627
onContentProcessDidTerminate={_ =>
@@ -721,7 +721,7 @@ More at <https://github.com/react-native-webview/react-native-webview/blob/maste
721721

722722
Specifies a function to be invoked when there is an error.
723723

724-
```reason
724+
```rescript
725725
<ReactNativeWebView
726726
source=ReactNativeWebView.Source.uri(~uri="https://facebook.github.io/react-native", ())
727727
renderError={errorName => <Error name=errorName />}
@@ -732,7 +732,7 @@ Specifies a function to be invoked when there is an error.
732732

733733
Specifies a function to be invoked when the `WebView` is loading. Requires setting `startInLoadingState=true` .
734734

735-
```reason
735+
```rescript
736736
<ReactNativeWebView
737737
source=ReactNativeWebView.Source.uri(~uri="https://facebook.github.io/react-native", ())
738738
startInLoadingState=true
@@ -803,8 +803,8 @@ Specifies `User-Agent` header for the WebView
803803
### `View` props
804804

805805
Refer to
806-
[`reason-react-native`](https://github.com/reason-react-native/react-native)
807-
[documentation](https://reason-react-native.github.io/en/docs/components/View/).
806+
[`rescript-react-native`](https://github.com/rescript-react-native/react-native)
807+
[documentation](https://rescript-react-native.github.io/en/docs/components/View/).
808808

809809
Please do note the below:
810810

@@ -816,7 +816,7 @@ allows to customize the WebView style. Please note that there are default styles
816816

817817
For the methods below, [`element`](#element) representing the `WebView` instance needs to be determined from the [`ref`](#ref) which itself can be defined and passed to the `WebView` [`ref`](#ref-ref) prop as below:
818818

819-
```reason
819+
```rescript
820820
let ref = React.createRef();
821821
822822
<ReactNativeWebView
@@ -825,7 +825,7 @@ let ref = React.createRef();
825825

826826
The `element` can be determined and the method [`reload`](#reload-element--unit) may be called as below:
827827

828-
```reason
828+
```rescript
829829
switch (ref -> React.Ref.current -> Js.Nullable.toOption) {
830830
| None => Js.Console.warn("no element")
831831
| Some(e) => ReactNativeWebView.reload(e)
@@ -882,10 +882,10 @@ releases.
882882

883883
## Contribute
884884

885-
Read the [contribution guidelines](https://github.com/reason-react-native/.github/blob/master/CONTRIBUTING.md) before contributing.
885+
Read the [contribution guidelines](https://github.com/rescript-react-native/.github/blob/master/CONTRIBUTING.md) before contributing.
886886

887887
## Code of Conduct
888888

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

bsconfig.json

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
2-
"name": "@reason-react-native/webview",
3-
"refmt": 3,
4-
"reason": {
5-
"react-jsx": 3
6-
},
2+
"name": "@rescript-react-native/webview",
3+
"reason": { "react-jsx": 3 },
74
"package-specs": {
85
"module": "commonjs",
96
"in-source": true
@@ -19,5 +16,5 @@
1916
"warnings": {
2017
"error": true
2118
},
22-
"bs-dependencies": ["reason-react", "reason-react-native"]
19+
"bs-dependencies": ["@rescript/react", "rescript-react-native"]
2320
}

package.json

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@reason-react-native/webview",
2+
"name": "@rescript-react-native/webview",
33
"description": "ReScript bindings for react-native-webview.",
44
"version": "10.8.0",
55
"publishConfig": {
@@ -9,21 +9,19 @@
99
"react-native-webview": "^10.8.0"
1010
},
1111
"author": "sgny (https://github.com/sgny)",
12-
"repository": "https://github.com/reason-react-native/webview.git",
12+
"repository": "https://github.com/rescript-react-native/webview.git",
1313
"license": "MIT",
1414
"keywords": [
1515
"rescript",
16-
"reason",
17-
"reasonml",
18-
"bucklescript",
1916
"react-native",
2017
"react-native-webview",
2118
"webview"
2219
],
2320
"files": [
2421
"*.md",
2522
"bsconfig.json",
26-
"src/**/*.re",
23+
"src/**/*.res",
24+
"src/**/*.resi",
2725
"src/**/*.js",
2826
"!src/**/*.bs.js"
2927
],
@@ -40,13 +38,13 @@
4038
"release": "npmpub"
4139
},
4240
"devDependencies": {
43-
"bs-platform": "^8.2.0",
41+
"bs-platform": "^9.0.0",
4442
"husky": "^4.0.0",
4543
"lint-staged": "^10.0.0",
4644
"npmpub": "^5.0.0",
4745
"prettier": "^2.0.0",
48-
"reason-react": "^0.9.0",
49-
"reason-react-native": "^0.63.0"
46+
"@rescript/react": "^0.10.0",
47+
"rescript-react-native": "^0.64.3"
5048
},
5149
"prettier": {
5250
"trailingComma": "all"

src/ReactNativeWebView.bs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
var Event$ReactNative = require("reason-react-native/src/apis/Event.bs.js");
4-
var NativeElement$ReactNative = require("reason-react-native/src/elements/NativeElement.bs.js");
3+
var Event$ReactNative = require("rescript-react-native/src/apis/Event.bs.js");
4+
var NativeElement$ReactNative = require("rescript-react-native/src/elements/NativeElement.bs.js");
55
var ReactNativeWebView_UnionCallback = require("./ReactNativeWebView_UnionCallback.bs.js");
66

77
var Source = {};

0 commit comments

Comments
 (0)