Skip to content

Commit

Permalink
fix iOS11 safeArea - wix#1858 (wix#1859)
Browse files Browse the repository at this point in the history
  • Loading branch information
gran33 authored and junedomingo committed Sep 29, 2017
1 parent d6512f1 commit bed862e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion ios/RCCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,24 @@ - (void)_traverseAndCall:(UIView*)view
}];
}

// fix iOS11 safeArea - https://github.com/facebook/react-native/issues/15681
// rnn issue - https://github.com/wix/react-native-navigation/issues/1858
- (void)_traverseAndFixScrollViewSafeArea:(UIView *)view {
#ifdef __IPHONE_11_0
if ([view isKindOfClass:UIScrollView.class]) {
[((UIScrollView*)view) setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];
}

[view.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
[self _traverseAndFixScrollViewSafeArea:obj];
}];
#endif

}

- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];

[self sendGlobalScreenEvent:@"didAppear" endTimestampString:[self getTimestampString] shouldReset:YES];
[self sendScreenChangedEvent:@"didAppear"];

Expand All @@ -300,6 +314,7 @@ - (void)viewDidAppear:(BOOL)animated
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self _traverseAndFixScrollViewSafeArea:self.view];
[self sendGlobalScreenEvent:@"willAppear" endTimestampString:[self getTimestampString] shouldReset:NO];
[self sendScreenChangedEvent:@"willAppear"];
[self setStyleOnAppear];
Expand Down

0 comments on commit bed862e

Please sign in to comment.