Ran Greenberg před 7 roky
rodič
revize
f34383695a
1 změnil soubory, kde provedl 16 přidání a 1 odebrání
  1. 16
    1
      ios/RCCViewController.m

+ 16
- 1
ios/RCCViewController.m Zobrazit soubor

@@ -288,10 +288,24 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
288 288
   }];
289 289
 }
290 290
 
291
+// fix iOS11 safeArea - https://github.com/facebook/react-native/issues/15681
292
+// rnn issue - https://github.com/wix/react-native-navigation/issues/1858
293
+- (void)_traverseAndFixScrollViewSafeArea:(UIView *)view {
294
+#ifdef __IPHONE_11_0
295
+  if ([view isKindOfClass:UIScrollView.class]) {
296
+    [((UIScrollView*)view) setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
297
+  }
298
+  
299
+  [view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
300
+    [self _traverseAndFixScrollViewSafeArea:obj];
301
+  }];
302
+#endif
303
+  
304
+}
305
+
291 306
 - (void)viewDidAppear:(BOOL)animated
292 307
 {
293 308
   [super viewDidAppear:animated];
294
-  
295 309
   [self sendGlobalScreenEvent:@"didAppear" endTimestampString:[self getTimestampString] shouldReset:YES];
296 310
   [self sendScreenChangedEvent:@"didAppear"];
297 311
   
@@ -300,6 +314,7 @@ const NSInteger TRANSPARENT_NAVBAR_TAG = 78264803;
300 314
 - (void)viewWillAppear:(BOOL)animated
301 315
 {
302 316
   [super viewWillAppear:animated];
317
+  [self _traverseAndFixScrollViewSafeArea:self.view];
303 318
   [self sendGlobalScreenEvent:@"willAppear" endTimestampString:[self getTimestampString] shouldReset:NO];
304 319
   [self sendScreenChangedEvent:@"willAppear"];
305 320
   [self setStyleOnAppear];