|
@@ -31,7 +31,7 @@ var WEBVIEW_REF = 'webview';
|
31
|
31
|
var DEFAULT_URL = 'https://m.facebook.com';
|
32
|
32
|
const FILE_SYSTEM_ORIGIN_WHITE_LIST = ['file://*', 'http://*', 'https://*'];
|
33
|
33
|
|
34
|
|
-class WebViewExample extends React.Component<{}, $FlowFixMeState> {
|
|
34
|
+class WebViewExample extends React.Component {
|
35
|
35
|
state = {
|
36
|
36
|
url: DEFAULT_URL,
|
37
|
37
|
status: 'No Page Loaded',
|
|
@@ -156,7 +156,7 @@ class WebViewExample extends React.Component<{}, $FlowFixMeState> {
|
156
|
156
|
};
|
157
|
157
|
}
|
158
|
158
|
|
159
|
|
-class Button extends React.Component<$FlowFixMeProps> {
|
|
159
|
+class Button extends React.Component {
|
160
|
160
|
_handlePress = () => {
|
161
|
161
|
if (this.props.enabled !== false && this.props.onPress) {
|
162
|
162
|
this.props.onPress();
|
|
@@ -174,7 +174,7 @@ class Button extends React.Component<$FlowFixMeProps> {
|
174
|
174
|
}
|
175
|
175
|
}
|
176
|
176
|
|
177
|
|
-class ScaledWebView extends React.Component<{}, $FlowFixMeState> {
|
|
177
|
+class ScaledWebView extends React.Component {
|
178
|
178
|
state = {
|
179
|
179
|
scalingEnabled: true,
|
180
|
180
|
};
|
|
@@ -210,7 +210,7 @@ class ScaledWebView extends React.Component<{}, $FlowFixMeState> {
|
210
|
210
|
}
|
211
|
211
|
}
|
212
|
212
|
|
213
|
|
-class MessagingTest extends React.Component<{}, $FlowFixMeState> {
|
|
213
|
+class MessagingTest extends React.Component {
|
214
|
214
|
webview = null;
|
215
|
215
|
|
216
|
216
|
state = {
|
|
@@ -230,7 +230,7 @@ class MessagingTest extends React.Component<{}, $FlowFixMeState> {
|
230
|
230
|
}
|
231
|
231
|
};
|
232
|
232
|
|
233
|
|
- render(): React.Node {
|
|
233
|
+ render() {
|
234
|
234
|
const { messagesReceivedFromWebView, message } = this.state;
|
235
|
235
|
|
236
|
236
|
return (
|
|
@@ -267,7 +267,7 @@ class MessagingTest extends React.Component<{}, $FlowFixMeState> {
|
267
|
267
|
}
|
268
|
268
|
}
|
269
|
269
|
|
270
|
|
-class InjectJS extends React.Component<{}> {
|
|
270
|
+class InjectJS extends React.Component {
|
271
|
271
|
webview = null;
|
272
|
272
|
injectJS = () => {
|
273
|
273
|
const script = 'document.write("Injected JS ")';
|
|
@@ -411,25 +411,25 @@ const HTML = `
|
411
|
411
|
</html>
|
412
|
412
|
`;
|
413
|
413
|
|
414
|
|
-exports.displayName = (undefined: ?string);
|
|
414
|
+exports.displayName = undefined;
|
415
|
415
|
exports.title = '<WebView>';
|
416
|
416
|
exports.description = 'Base component to display web content';
|
417
|
417
|
exports.examples = [
|
418
|
418
|
{
|
419
|
419
|
title: 'Simple Browser',
|
420
|
|
- render(): React.Element<any> {
|
|
420
|
+ render() {
|
421
|
421
|
return <WebViewExample />;
|
422
|
422
|
},
|
423
|
423
|
},
|
424
|
424
|
{
|
425
|
425
|
title: 'Scale Page to Fit',
|
426
|
|
- render(): React.Element<any> {
|
|
426
|
+ render() {
|
427
|
427
|
return <ScaledWebView />;
|
428
|
428
|
},
|
429
|
429
|
},
|
430
|
430
|
{
|
431
|
431
|
title: 'Bundled HTML',
|
432
|
|
- render(): React.Element<any> {
|
|
432
|
+ render() {
|
433
|
433
|
return (
|
434
|
434
|
<WebView
|
435
|
435
|
style={{
|
|
@@ -445,7 +445,7 @@ exports.examples = [
|
445
|
445
|
},
|
446
|
446
|
{
|
447
|
447
|
title: 'Static HTML',
|
448
|
|
- render(): React.Element<any> {
|
|
448
|
+ render() {
|
449
|
449
|
return (
|
450
|
450
|
<WebView
|
451
|
451
|
style={{
|
|
@@ -460,7 +460,7 @@ exports.examples = [
|
460
|
460
|
},
|
461
|
461
|
{
|
462
|
462
|
title: 'POST Test',
|
463
|
|
- render(): React.Element<any> {
|
|
463
|
+ render() {
|
464
|
464
|
return (
|
465
|
465
|
<WebView
|
466
|
466
|
style={{
|
|
@@ -479,13 +479,13 @@ exports.examples = [
|
479
|
479
|
},
|
480
|
480
|
{
|
481
|
481
|
title: 'Messaging Test',
|
482
|
|
- render(): React.Element<any> {
|
|
482
|
+ render() {
|
483
|
483
|
return <MessagingTest />;
|
484
|
484
|
},
|
485
|
485
|
},
|
486
|
486
|
{
|
487
|
487
|
title: 'Inject JavaScript',
|
488
|
|
- render(): React.Element<any> {
|
|
488
|
+ render() {
|
489
|
489
|
return <InjectJS />;
|
490
|
490
|
},
|
491
|
491
|
},
|