瀏覽代碼

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

fixes #371
Thibault Malbranche 5 年之前
父節點
當前提交
2cef5cbb3f
No account linked to committer's email address
共有 1 個檔案被更改,包括 3 行新增8 行删除
  1. 3
    8
      ios/RNCWKWebView.m

+ 3
- 8
ios/RNCWKWebView.m 查看文件

@@ -341,19 +341,14 @@ static NSURLCredential* clientAuthenticationCredential;
341 341
 {
342 342
   _scrollEnabled = scrollEnabled;
343 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 346
 - (void)scrollViewDidScroll:(UIScrollView *)scrollView
354 347
 {
355 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 354
 - (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator