Browse Source

Apply @kmagiera's suggested getScrollableNode() implementation.

Jamie Birch 4 years ago
parent
commit
a231d26248
2 changed files with 2 additions and 10 deletions
  1. 1
    5
      src/WebView.android.tsx
  2. 1
    5
      src/WebView.ios.tsx

+ 1
- 5
src/WebView.android.tsx View File

76
    * @see: Implementation: https://github.com/facebook/react-native/blob/8ddf231306e3bd85be718940d04f11d23b570a62/Libraries/Lists/VirtualizedList.js#L515-L521
76
    * @see: Implementation: https://github.com/facebook/react-native/blob/8ddf231306e3bd85be718940d04f11d23b570a62/Libraries/Lists/VirtualizedList.js#L515-L521
77
    */
77
    */
78
   getScrollableNode = () => {
78
   getScrollableNode = () => {
79
-    if (this.webViewRef.current && this.webViewRef.current.getScrollableNode) {
80
-      return this.webViewRef.current.getScrollableNode();
81
-    } else {
82
-      return findNodeHandle(this.webViewRef.current);
83
-    }
79
+    return this.webViewRef.current;
84
   };
80
   };
85
 
81
 
86
   getCommands = () => UIManager.getViewManagerConfig('RNCWebView').Commands;
82
   getCommands = () => UIManager.getViewManagerConfig('RNCWebView').Commands;

+ 1
- 5
src/WebView.ios.tsx View File

80
    * @see: Implementation: https://github.com/facebook/react-native/blob/8ddf231306e3bd85be718940d04f11d23b570a62/Libraries/Lists/VirtualizedList.js#L515-L521
80
    * @see: Implementation: https://github.com/facebook/react-native/blob/8ddf231306e3bd85be718940d04f11d23b570a62/Libraries/Lists/VirtualizedList.js#L515-L521
81
    */
81
    */
82
   getScrollableNode = () => {
82
   getScrollableNode = () => {
83
-    if (this.webViewRef.current && this.webViewRef.current.getScrollableNode) {
84
-      return this.webViewRef.current.getScrollableNode();
85
-    } else {
86
-      return findNodeHandle(this.webViewRef.current);
87
-    }
83
+    return this.webViewRef.current;
88
   };
84
   };
89
 
85
 
90
   // eslint-disable-next-line react/sort-comp
86
   // eslint-disable-next-line react/sort-comp