Browse Source

fix(WKWebView Scrolling): fixed broken scroll (#372)

fixes #371
Thibault Malbranche 5 years ago
parent
commit
2cef5cbb3f
No account linked to committer's email address
1 changed files with 3 additions and 8 deletions
  1. 3
    8
      ios/RNCWKWebView.m

+ 3
- 8
ios/RNCWKWebView.m View File

341
 {
341
 {
342
   _scrollEnabled = scrollEnabled;
342
   _scrollEnabled = scrollEnabled;
343
   _webView.scrollView.scrollEnabled = scrollEnabled;
343
   _webView.scrollView.scrollEnabled = scrollEnabled;
344
-
345
-  // Override the scrollView delegate to prevent scrolling.
346
-  if (!scrollEnabled) {
347
-    _webView.scrollView.delegate = self;
348
-  } else {
349
-    _webView.scrollView.delegate = _webView;
350
-  }
351
 }
344
 }
352
 
345
 
353
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
346
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
354
 {
347
 {
355
   // Don't allow scrolling the scrollView.
348
   // Don't allow scrolling the scrollView.
356
-  scrollView.bounds = _webView.bounds;
349
+  if (!_scrollEnabled) {
350
+    scrollView.bounds = _webView.bounds;
351
+  }
357
 }
352
 }
358
 
353
 
359
 - (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator
354
 - (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator