Skip to content

Commit 777f22a

Browse files
cknittMoOx
authored andcommitted
bs-react-native-next: WebView (#396)
1 parent e17562f commit 777f22a

9 files changed

Lines changed: 421 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
'use strict';
2+
3+
4+
var Source = /* module */[];
5+
6+
var DataDetectorTypes = 0;
7+
8+
var DecelerationRate = 0;
9+
10+
exports.Source = Source;
11+
exports.DataDetectorTypes = DataDetectorTypes;
12+
exports.DecelerationRate = DecelerationRate;
13+
/* No side effect */
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
---
2+
id: components/WebView
3+
title: WebView
4+
wip: true
5+
---
6+
7+
```reason
8+
type element;
9+
type ref = React.Ref.t(Js.nullable(element));
10+
11+
module Source = {
12+
type t;
13+
14+
[@bs.obj]
15+
external uri:
16+
(
17+
~uri: string=?,
18+
~method: string=?,
19+
~headers: Js.t('a)=?,
20+
~body: string=?,
21+
unit
22+
) =>
23+
t =
24+
"";
25+
26+
[@bs.obj]
27+
external html: (~html: string=?, ~baseUrl: string=?, unit) => t = "";
28+
};
29+
30+
module DataDetectorTypes = WebView_DataDetectorTypes;
31+
module DecelerationRate = WebView_DecelerationRate;
32+
33+
type messageEvent = Event.event({. "data": string});
34+
35+
type webViewEvent =
36+
Event.event({
37+
.
38+
"url": string,
39+
"title": string,
40+
"loading": bool,
41+
"canGoBack": bool,
42+
"canGoForward": bool,
43+
});
44+
45+
type request = {
46+
.
47+
"url": string,
48+
"title": string,
49+
"loading": bool,
50+
"canGoBack": bool,
51+
"canGoForward": bool,
52+
"lockIdentifier": string,
53+
"navigationType": string,
54+
};
55+
56+
[@react.component] [@bs.module "react-native"]
57+
external make:
58+
(
59+
~allowFileAccess: bool=?,
60+
~allowsInlineMediaPlayback: bool=?,
61+
~allowUniversalAccessFromFileURLs: bool=?,
62+
~automaticallyAdjustContentInsets: bool=?,
63+
~bounces: bool=?,
64+
~contentInsets: Types.insets=?,
65+
~dataDetectorTypes: array(DataDetectorTypes.t)=?,
66+
~decelerationRate: DecelerationRate.t=?,
67+
~domStorageEnabled: bool=?,
68+
~geolocationEnabled: bool=?,
69+
~injectedJavaScript: string=?,
70+
~injectJavaScript: string => unit=?,
71+
~javaScriptEnabled: bool=?,
72+
~mediaPlaybackRequiresUserAction: bool=?,
73+
~mixedContentMode: [@bs.string] [ | `never | `always | `compatibility]=?,
74+
~onError: webViewEvent => unit=?,
75+
~onLoad: webViewEvent => unit=?,
76+
~onLoadEnd: webViewEvent => unit=?,
77+
~onLoadStart: webViewEvent => unit=?,
78+
~onMessage: messageEvent => unit=?,
79+
~onNavigationStateChange: webViewEvent => unit=?,
80+
~onShouldStartLoadWithRequest: request => unit=?,
81+
~originWhitelist: array(string)=?,
82+
~renderError: string => React.element=?,
83+
~renderLoading: unit => React.element=?,
84+
~scalesPageToFit: bool=?,
85+
~scrollEnabled: bool=?,
86+
~source: Source.t=?,
87+
~startInLoadingState: bool=?,
88+
~thirdPartyCookiesEnabled: bool=?,
89+
~userAgent: string=?,
90+
~useWebKit: bool=?,
91+
// View props
92+
~accessibilityComponentType: [@bs.string] [
93+
| `none
94+
| `button
95+
| `radiobutton_checked
96+
| `radiobutton_unchecked
97+
]
98+
=?,
99+
~accessibilityElementsHidden: bool=?,
100+
~accessibilityHint: string=?,
101+
~accessibilityIgnoresInvertColors: bool=?,
102+
~accessibilityLabel: string=?,
103+
~accessibilityLiveRegion: [@bs.string] [ | `none | `polite | `assertive]=?,
104+
~accessibilityRole: [@bs.string] [
105+
| `none
106+
| `button
107+
| `link
108+
| `search
109+
| `image
110+
| `keyboardkey
111+
| `text
112+
| `adjustable
113+
| `header
114+
| `summary
115+
| `imagebutton
116+
]
117+
=?,
118+
~accessibilityStates: array(AccessibilityState.t)=?,
119+
~accessibilityTraits: array(AccessibilityTrait.t)=?,
120+
~accessibilityViewIsModal: bool=?,
121+
~accessible: bool=?,
122+
~collapsable: bool=?,
123+
~hitSlop: Types.insets=?,
124+
~importantForAccessibility: [@bs.string] [
125+
| `auto
126+
| `yes
127+
| `no
128+
| [@bs.as "no-hide-descendants"]
129+
`noHideDescendants
130+
]
131+
=?,
132+
~nativeID: string=?,
133+
~needsOffscreenAlphaCompositing: bool=?,
134+
~onAccessibilityTap: unit => unit=?,
135+
~onLayout: Event.layoutEvent => unit=?,
136+
~onMagicTap: unit => unit=?,
137+
// Gesture Responder props
138+
~onMoveShouldSetResponder: Event.pressEvent => bool=?,
139+
~onMoveShouldSetResponderCapture: Event.pressEvent => bool=?,
140+
~onResponderGrant: Event.pressEvent => unit=?,
141+
~onResponderMove: Event.pressEvent => unit=?,
142+
~onResponderReject: Event.pressEvent => unit=?,
143+
~onResponderRelease: Event.pressEvent => unit=?,
144+
~onResponderTerminate: Event.pressEvent => unit=?,
145+
~onResponderTerminationRequest: Event.pressEvent => unit=?,
146+
~onStartShouldSetResponder: Event.pressEvent => bool=?,
147+
~onStartShouldSetResponderCapture: Event.pressEvent => bool=?,
148+
~pointerEvents: [@bs.string] [
149+
| `auto
150+
| `none
151+
| [@bs.as "box-none"] `boxNone
152+
| [@bs.as "box-only"] `boxOnly
153+
]
154+
=?,
155+
~removeClippedSubviews: bool=?,
156+
~renderToHardwareTextureAndroid: bool=?,
157+
~shouldRasterizeIOS: bool=?,
158+
~style: Style.t=?,
159+
~testID: string=?
160+
) =>
161+
React.element =
162+
"WebView";
163+
164+
// Methods
165+
// static extraNativeComponentConfig() ??
166+
[@bs.send] external goForward: element => unit = "";
167+
[@bs.send] external goBack: element => unit = "";
168+
[@bs.send] external reload: element => unit = "";
169+
[@bs.send] external stopLoading: element => unit = "";
170+
```
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
type element;
2+
type ref = React.Ref.t(Js.nullable(element));
3+
4+
module Source = {
5+
type t;
6+
7+
[@bs.obj]
8+
external uri:
9+
(
10+
~uri: string=?,
11+
~method: string=?,
12+
~headers: Js.t('a)=?,
13+
~body: string=?,
14+
unit
15+
) =>
16+
t =
17+
"";
18+
19+
[@bs.obj]
20+
external html: (~html: string=?, ~baseUrl: string=?, unit) => t = "";
21+
};
22+
23+
module DataDetectorTypes = WebView_DataDetectorTypes;
24+
module DecelerationRate = WebView_DecelerationRate;
25+
26+
type messageEvent = Event.event({. "data": string});
27+
28+
type webViewEvent =
29+
Event.event({
30+
.
31+
"url": string,
32+
"title": string,
33+
"loading": bool,
34+
"canGoBack": bool,
35+
"canGoForward": bool,
36+
});
37+
38+
type request = {
39+
.
40+
"url": string,
41+
"title": string,
42+
"loading": bool,
43+
"canGoBack": bool,
44+
"canGoForward": bool,
45+
"lockIdentifier": string,
46+
"navigationType": string,
47+
};
48+
49+
[@react.component] [@bs.module "react-native"]
50+
external make:
51+
(
52+
~allowFileAccess: bool=?,
53+
~allowsInlineMediaPlayback: bool=?,
54+
~allowUniversalAccessFromFileURLs: bool=?,
55+
~automaticallyAdjustContentInsets: bool=?,
56+
~bounces: bool=?,
57+
~contentInsets: Types.insets=?,
58+
~dataDetectorTypes: array(DataDetectorTypes.t)=?,
59+
~decelerationRate: DecelerationRate.t=?,
60+
~domStorageEnabled: bool=?,
61+
~geolocationEnabled: bool=?,
62+
~injectedJavaScript: string=?,
63+
~injectJavaScript: string => unit=?,
64+
~javaScriptEnabled: bool=?,
65+
~mediaPlaybackRequiresUserAction: bool=?,
66+
~mixedContentMode: [@bs.string] [ | `never | `always | `compatibility]=?,
67+
~onError: webViewEvent => unit=?,
68+
~onLoad: webViewEvent => unit=?,
69+
~onLoadEnd: webViewEvent => unit=?,
70+
~onLoadStart: webViewEvent => unit=?,
71+
~onMessage: messageEvent => unit=?,
72+
~onNavigationStateChange: webViewEvent => unit=?,
73+
~onShouldStartLoadWithRequest: request => unit=?,
74+
~originWhitelist: array(string)=?,
75+
~renderError: string => React.element=?,
76+
~renderLoading: unit => React.element=?,
77+
~scalesPageToFit: bool=?,
78+
~scrollEnabled: bool=?,
79+
~source: Source.t=?,
80+
~startInLoadingState: bool=?,
81+
~thirdPartyCookiesEnabled: bool=?,
82+
~userAgent: string=?,
83+
~useWebKit: bool=?,
84+
// View props
85+
~accessibilityComponentType: [@bs.string] [
86+
| `none
87+
| `button
88+
| `radiobutton_checked
89+
| `radiobutton_unchecked
90+
]
91+
=?,
92+
~accessibilityElementsHidden: bool=?,
93+
~accessibilityHint: string=?,
94+
~accessibilityIgnoresInvertColors: bool=?,
95+
~accessibilityLabel: string=?,
96+
~accessibilityLiveRegion: [@bs.string] [ | `none | `polite | `assertive]=?,
97+
~accessibilityRole: [@bs.string] [
98+
| `none
99+
| `button
100+
| `link
101+
| `search
102+
| `image
103+
| `keyboardkey
104+
| `text
105+
| `adjustable
106+
| `header
107+
| `summary
108+
| `imagebutton
109+
]
110+
=?,
111+
~accessibilityStates: array(AccessibilityState.t)=?,
112+
~accessibilityTraits: array(AccessibilityTrait.t)=?,
113+
~accessibilityViewIsModal: bool=?,
114+
~accessible: bool=?,
115+
~collapsable: bool=?,
116+
~hitSlop: Types.insets=?,
117+
~importantForAccessibility: [@bs.string] [
118+
| `auto
119+
| `yes
120+
| `no
121+
| [@bs.as "no-hide-descendants"]
122+
`noHideDescendants
123+
]
124+
=?,
125+
~nativeID: string=?,
126+
~needsOffscreenAlphaCompositing: bool=?,
127+
~onAccessibilityTap: unit => unit=?,
128+
~onLayout: Event.layoutEvent => unit=?,
129+
~onMagicTap: unit => unit=?,
130+
// Gesture Responder props
131+
~onMoveShouldSetResponder: Event.pressEvent => bool=?,
132+
~onMoveShouldSetResponderCapture: Event.pressEvent => bool=?,
133+
~onResponderGrant: Event.pressEvent => unit=?,
134+
~onResponderMove: Event.pressEvent => unit=?,
135+
~onResponderReject: Event.pressEvent => unit=?,
136+
~onResponderRelease: Event.pressEvent => unit=?,
137+
~onResponderTerminate: Event.pressEvent => unit=?,
138+
~onResponderTerminationRequest: Event.pressEvent => unit=?,
139+
~onStartShouldSetResponder: Event.pressEvent => bool=?,
140+
~onStartShouldSetResponderCapture: Event.pressEvent => bool=?,
141+
~pointerEvents: [@bs.string] [
142+
| `auto
143+
| `none
144+
| [@bs.as "box-none"] `boxNone
145+
| [@bs.as "box-only"] `boxOnly
146+
]
147+
=?,
148+
~removeClippedSubviews: bool=?,
149+
~renderToHardwareTextureAndroid: bool=?,
150+
~shouldRasterizeIOS: bool=?,
151+
~style: Style.t=?,
152+
~testID: string=?
153+
) =>
154+
React.element =
155+
"WebView";
156+
157+
// Methods
158+
// static extraNativeComponentConfig() ??
159+
[@bs.send] external goForward: element => unit = "";
160+
[@bs.send] external goBack: element => unit = "";
161+
[@bs.send] external reload: element => unit = "";
162+
[@bs.send] external stopLoading: element => unit = "";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/* This output is empty. Its source's type definitions, externals and/or unused code got optimized away. */
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
type t = string;
2+
3+
[@bs.inline]
4+
let phoneNumber = "phoneNumber";
5+
6+
[@bs.inline]
7+
let link = "link";
8+
9+
[@bs.inline]
10+
let address = "address";
11+
12+
[@bs.inline]
13+
let calendarEvent = "calendarEvent";
14+
15+
[@bs.inline]
16+
let none = "none";
17+
18+
[@bs.inline]
19+
let all = "all";
20+
21+
[@bs.inline]
22+
let trackingNumber = "trackingNumber";
23+
24+
[@bs.inline]
25+
let flightNumber = "flightNumber";
26+
27+
[@bs.inline]
28+
let lookupSuggestion = "lookupSuggestion";

0 commit comments

Comments
 (0)