Browse Source

removed underscore dangling

Thibault Malbranche 6 years ago
parent
commit
9c5344f127
3 changed files with 30 additions and 25 deletions
  1. 4
    0
      .eslintrc.js
  2. 2
    1
      index.ts
  3. 24
    24
      src/WebView.ios.tsx

+ 4
- 0
.eslintrc.js View File

43
         extensions: [
43
         extensions: [
44
           '.js',
44
           '.js',
45
           '.jsx',
45
           '.jsx',
46
+          '.android.jsx',
47
+          '.android.js',
48
+          '.ios.jsx',
49
+          '.ios.js',
46
           '.tsx',
50
           '.tsx',
47
           '.ts',
51
           '.ts',
48
           '.android.tsx',
52
           '.android.tsx',

+ 2
- 1
index.ts View File

2
 import WebViewIOS from './src/WebView.ios';
2
 import WebViewIOS from './src/WebView.ios';
3
 import WebViewAndroid from './src/WebView.android';
3
 import WebViewAndroid from './src/WebView.android';
4
 
4
 
5
-// We keep this for compatibility reasons.
6
 const WebView = Platform.OS === 'android' ? WebViewAndroid : WebViewIOS;
5
 const WebView = Platform.OS === 'android' ? WebViewAndroid : WebViewIOS;
6
+
7
+// We keep this for compatibility reasons.
7
 export { WebView };
8
 export { WebView };
8
 
9
 
9
 export default WebView;
10
 export default WebView;

+ 24
- 24
src/WebView.ios.tsx View File

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