Bill Xie 4 years ago
parent
commit
b2bd5be426
No account linked to committer's email address
2 changed files with 24 additions and 1 deletions
  1. 21
    1
      ios/RNCWebView.m
  2. 3
    0
      ios/RNCWebViewManager.m

+ 21
- 1
ios/RNCWebView.m View File

@@ -104,6 +104,9 @@ static NSDictionary* customCertificatesForHost;
104 104
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
105 105
   UIScrollViewContentInsetAdjustmentBehavior _savedContentInsetAdjustmentBehavior;
106 106
 #endif
107
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
108
+  BOOL _savedAutomaticallyAdjustsScrollIndicatorInsets;
109
+#endif
107 110
 }
108 111
 
109 112
 - (instancetype)initWithFrame:(CGRect)frame
@@ -130,6 +133,10 @@ static NSDictionary* customCertificatesForHost;
130 133
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
131 134
     _savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
132 135
 #endif
136
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
137
+    _savedAutomaticallyAdjustsScrollIndicatorInsets = NO;
138
+#endif
139
+      
133 140
   }
134 141
 
135 142
 #if !TARGET_OS_OSX
@@ -368,6 +375,9 @@ static NSDictionary* customCertificatesForHost;
368 375
       _webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior;
369 376
     }
370 377
 #endif
378
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
379
+    _webView.scrollView.automaticallyAdjustsScrollIndicatorInsets = _savedAutomaticallyAdjustsScrollIndicatorInsets;
380
+#endif
371 381
 
372 382
     [self addSubview:_webView];
373 383
     [self setHideKeyboardAccessoryView: _savedHideKeyboardAccessoryView];
@@ -503,7 +513,17 @@ static NSDictionary* customCertificatesForHost;
503 513
     }
504 514
 }
505 515
 #endif
506
-
516
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
517
+- (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjustsScrollIndicatorInsets{
518
+    _savedAutomaticallyAdjustsScrollIndicatorInsets = automaticallyAdjustsScrollIndicatorInsets;
519
+    if (_webView == nil) {
520
+           return;
521
+       }
522
+       if ([_webView.scrollView respondsToSelector:@selector(setAutomaticallyAdjustsScrollIndicatorInsets:)]) {
523
+           _webView.scrollView.automaticallyAdjustsScrollIndicatorInsets = automaticallyAdjustsScrollIndicatorInsets;
524
+       }
525
+}
526
+#endif
507 527
 /**
508 528
  * This method is called whenever JavaScript running within the web view calls:
509 529
  *   - window.webkit.messageHandlers[MessageHandlerName].postMessage

+ 3
- 0
ios/RNCWebViewManager.m View File

@@ -65,6 +65,9 @@ RCT_EXPORT_VIEW_PROPERTY(allowingReadAccessToURL, NSString)
65 65
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
66 66
 RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
67 67
 #endif
68
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
69
+RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustsScrollIndicatorInsets, BOOL)
70
+#endif
68 71
 
69 72
 /**
70 73
  * Expose methods to enable messaging the webview.