|
@@ -196,9 +196,9 @@ export default class WebView extends React.Component<
|
196
|
196
|
return;
|
197
|
197
|
}
|
198
|
198
|
|
199
|
|
- this._showRedboxOnPropChanges(prevProps, 'allowsInlineMediaPlayback');
|
200
|
|
- this._showRedboxOnPropChanges(prevProps, 'mediaPlaybackRequiresUserAction');
|
201
|
|
- this._showRedboxOnPropChanges(prevProps, 'dataDetectorTypes');
|
|
199
|
+ this.showRedboxOnPropChanges(prevProps, 'allowsInlineMediaPlayback');
|
|
200
|
+ this.showRedboxOnPropChanges(prevProps, 'mediaPlaybackRequiresUserAction');
|
|
201
|
+ this.showRedboxOnPropChanges(prevProps, 'dataDetectorTypes');
|
202
|
202
|
|
203
|
203
|
if (this.props.scalesPageToFit !== undefined) {
|
204
|
204
|
console.warn(
|
|
@@ -213,12 +213,12 @@ export default class WebView extends React.Component<
|
213
|
213
|
goForward = (): void => {
|
214
|
214
|
UIManager.dispatchViewManagerCommand(
|
215
|
215
|
this.getWebViewHandle(),
|
216
|
|
- this._getCommands().goForward,
|
|
216
|
+ this.getCommands().goForward,
|
217
|
217
|
null,
|
218
|
218
|
);
|
219
|
219
|
};
|
220
|
220
|
|
221
|
|
- _getCommands(): {
|
|
221
|
+ getCommands(): {
|
222
|
222
|
goForward: () => void;
|
223
|
223
|
goBack: () => void;
|
224
|
224
|
reload: () => void;
|
|
@@ -239,7 +239,7 @@ export default class WebView extends React.Component<
|
239
|
239
|
goBack = (): void => {
|
240
|
240
|
UIManager.dispatchViewManagerCommand(
|
241
|
241
|
this.getWebViewHandle(),
|
242
|
|
- this._getCommands().goBack,
|
|
242
|
+ this.getCommands().goBack,
|
243
|
243
|
null,
|
244
|
244
|
);
|
245
|
245
|
};
|
|
@@ -251,7 +251,7 @@ export default class WebView extends React.Component<
|
251
|
251
|
this.setState({ viewState: WebViewState.LOADING });
|
252
|
252
|
UIManager.dispatchViewManagerCommand(
|
253
|
253
|
this.getWebViewHandle(),
|
254
|
|
- this._getCommands().reload,
|
|
254
|
+ this.getCommands().reload,
|
255
|
255
|
null,
|
256
|
256
|
);
|
257
|
257
|
};
|
|
@@ -262,7 +262,7 @@ export default class WebView extends React.Component<
|
262
|
262
|
stopLoading = (): void => {
|
263
|
263
|
UIManager.dispatchViewManagerCommand(
|
264
|
264
|
this.getWebViewHandle(),
|
265
|
|
- this._getCommands().stopLoading,
|
|
265
|
+ this.getCommands().stopLoading,
|
266
|
266
|
null,
|
267
|
267
|
);
|
268
|
268
|
};
|
|
@@ -280,7 +280,7 @@ export default class WebView extends React.Component<
|
280
|
280
|
postMessage = (data: string): void => {
|
281
|
281
|
UIManager.dispatchViewManagerCommand(
|
282
|
282
|
this.getWebViewHandle(),
|
283
|
|
- this._getCommands().postMessage,
|
|
283
|
+ this.getCommands().postMessage,
|
284
|
284
|
[String(data)],
|
285
|
285
|
);
|
286
|
286
|
};
|
|
@@ -294,7 +294,7 @@ export default class WebView extends React.Component<
|
294
|
294
|
injectJavaScript = (data: string): void => {
|
295
|
295
|
UIManager.dispatchViewManagerCommand(
|
296
|
296
|
this.getWebViewHandle(),
|
297
|
|
- this._getCommands().injectJavaScript,
|
|
297
|
+ this.getCommands().injectJavaScript,
|
298
|
298
|
[data],
|
299
|
299
|
);
|
300
|
300
|
};
|
|
@@ -303,7 +303,7 @@ export default class WebView extends React.Component<
|
303
|
303
|
* We return an event with a bunch of fields including:
|
304
|
304
|
* url, title, loading, canGoBack, canGoForward
|
305
|
305
|
*/
|
306
|
|
- _updateNavigationState = (event: WebViewNavigationEvent): void => {
|
|
306
|
+ updateNavigationState = (event: WebViewNavigationEvent): void => {
|
307
|
307
|
if (this.props.onNavigationStateChange) {
|
308
|
308
|
this.props.onNavigationStateChange(event.nativeEvent);
|
309
|
309
|
}
|
|
@@ -315,15 +315,15 @@ export default class WebView extends React.Component<
|
315
|
315
|
getWebViewHandle = (): number | null =>
|
316
|
316
|
findNodeHandle(this.webViewRef.current);
|
317
|
317
|
|
318
|
|
- _onLoadingStart = (event: WebViewNavigationEvent): void => {
|
|
318
|
+ onLoadingStart = (event: WebViewNavigationEvent): void => {
|
319
|
319
|
const { onLoadStart } = this.props;
|
320
|
320
|
if (onLoadStart) {
|
321
|
321
|
onLoadStart(event);
|
322
|
322
|
}
|
323
|
|
- this._updateNavigationState(event);
|
|
323
|
+ this.updateNavigationState(event);
|
324
|
324
|
};
|
325
|
325
|
|
326
|
|
- _onLoadingError = (event: WebViewErrorEvent): void => {
|
|
326
|
+ onLoadingError = (event: WebViewErrorEvent): void => {
|
327
|
327
|
event.persist(); // persist this event because we need to store it
|
328
|
328
|
const { onError, onLoadEnd } = this.props;
|
329
|
329
|
if (onError) {
|
|
@@ -340,7 +340,7 @@ export default class WebView extends React.Component<
|
340
|
340
|
});
|
341
|
341
|
};
|
342
|
342
|
|
343
|
|
- _onLoadingFinish = (event: WebViewNavigationEvent): void => {
|
|
343
|
+ onLoadingFinish = (event: WebViewNavigationEvent): void => {
|
344
|
344
|
const { onLoad, onLoadEnd } = this.props;
|
345
|
345
|
if (onLoad) {
|
346
|
346
|
onLoad(event);
|
|
@@ -351,17 +351,17 @@ export default class WebView extends React.Component<
|
351
|
351
|
this.setState({
|
352
|
352
|
viewState: WebViewState.IDLE,
|
353
|
353
|
});
|
354
|
|
- this._updateNavigationState(event);
|
|
354
|
+ this.updateNavigationState(event);
|
355
|
355
|
};
|
356
|
356
|
|
357
|
|
- _onMessage = (event: WebViewMessageEvent): void => {
|
|
357
|
+ onMessage = (event: WebViewMessageEvent): void => {
|
358
|
358
|
const { onMessage } = this.props;
|
359
|
359
|
if (onMessage) {
|
360
|
360
|
onMessage(event);
|
361
|
361
|
}
|
362
|
362
|
};
|
363
|
363
|
|
364
|
|
- _onLoadingProgress = (
|
|
364
|
+ onLoadingProgress = (
|
365
|
365
|
event: NativeSyntheticEvent<WebViewProgressEvent>,
|
366
|
366
|
): void => {
|
367
|
367
|
const { onLoadProgress } = this.props;
|
|
@@ -370,7 +370,7 @@ export default class WebView extends React.Component<
|
370
|
370
|
}
|
371
|
371
|
};
|
372
|
372
|
|
373
|
|
- _showRedboxOnPropChanges(
|
|
373
|
+ showRedboxOnPropChanges(
|
374
|
374
|
prevProps: WebViewSharedProps,
|
375
|
375
|
propName:
|
376
|
376
|
| 'allowsInlineMediaPlayback'
|
|
@@ -503,12 +503,12 @@ export default class WebView extends React.Component<
|
503
|
503
|
this.props.allowsBackForwardNavigationGestures
|
504
|
504
|
}
|
505
|
505
|
userAgent={this.props.userAgent}
|
506
|
|
- onLoadingStart={this._onLoadingStart}
|
507
|
|
- onLoadingFinish={this._onLoadingFinish}
|
508
|
|
- onLoadingError={this._onLoadingError}
|
509
|
|
- onLoadingProgress={this._onLoadingProgress}
|
|
506
|
+ onLoadingStart={this.onLoadingStart}
|
|
507
|
+ onLoadingFinish={this.onLoadingFinish}
|
|
508
|
+ onLoadingError={this.onLoadingError}
|
|
509
|
+ onLoadingProgress={this.onLoadingProgress}
|
510
|
510
|
messagingEnabled={messagingEnabled}
|
511
|
|
- onMessage={this._onMessage}
|
|
511
|
+ onMessage={this.onMessage}
|
512
|
512
|
onShouldStartLoadWithRequest={onShouldStartLoadWithRequest}
|
513
|
513
|
scalesPageToFit={scalesPageToFit}
|
514
|
514
|
allowsInlineMediaPlayback={this.props.allowsInlineMediaPlayback}
|