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

+ 21
- 1
apple/RNCWebView.m View File

109
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
109
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
110
   UIScrollViewContentInsetAdjustmentBehavior _savedContentInsetAdjustmentBehavior;
110
   UIScrollViewContentInsetAdjustmentBehavior _savedContentInsetAdjustmentBehavior;
111
 #endif
111
 #endif
112
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
113
+  BOOL _savedAutomaticallyAdjustsScrollIndicatorInsets;
114
+#endif
112
 }
115
 }
113
 
116
 
114
 - (instancetype)initWithFrame:(CGRect)frame
117
 - (instancetype)initWithFrame:(CGRect)frame
140
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
143
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
141
     _savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
144
     _savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
142
 #endif
145
 #endif
146
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
147
+    _savedAutomaticallyAdjustsScrollIndicatorInsets = NO;
148
+#endif
149
+      
143
   }
150
   }
144
 
151
 
145
 #if !TARGET_OS_OSX
152
 #if !TARGET_OS_OSX
299
       _webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior;
306
       _webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior;
300
     }
307
     }
301
 #endif
308
 #endif
309
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
310
+    _webView.scrollView.automaticallyAdjustsScrollIndicatorInsets = _savedAutomaticallyAdjustsScrollIndicatorInsets;
311
+#endif
302
 
312
 
303
     [self addSubview:_webView];
313
     [self addSubview:_webView];
304
     [self setHideKeyboardAccessoryView: _savedHideKeyboardAccessoryView];
314
     [self setHideKeyboardAccessoryView: _savedHideKeyboardAccessoryView];
445
     }
455
     }
446
 }
456
 }
447
 #endif
457
 #endif
448
-
458
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
459
+- (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjustsScrollIndicatorInsets{
460
+    _savedAutomaticallyAdjustsScrollIndicatorInsets = automaticallyAdjustsScrollIndicatorInsets;
461
+    if (_webView == nil) {
462
+           return;
463
+       }
464
+       if ([_webView.scrollView respondsToSelector:@selector(setAutomaticallyAdjustsScrollIndicatorInsets:)]) {
465
+           _webView.scrollView.automaticallyAdjustsScrollIndicatorInsets = automaticallyAdjustsScrollIndicatorInsets;
466
+       }
467
+}
468
+#endif
449
 /**
469
 /**
450
  * This method is called whenever JavaScript running within the web view calls:
470
  * This method is called whenever JavaScript running within the web view calls:
451
  *   - window.webkit.messageHandlers[MessageHandlerName].postMessage
471
  *   - window.webkit.messageHandlers[MessageHandlerName].postMessage

+ 3
- 0
apple/RNCWebViewManager.m View File

80
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
80
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
81
 RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
81
 RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior)
82
 #endif
82
 #endif
83
+#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */
84
+RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustsScrollIndicatorInsets, BOOL)
85
+#endif
83
 
86
 
84
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
87
 #if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */
85
 RCT_EXPORT_VIEW_PROPERTY(contentMode, WKContentMode)
88
 RCT_EXPORT_VIEW_PROPERTY(contentMode, WKContentMode)