Browse Source

Fix/rootview bounds iphone x (#3405)

* Fixed issue with rightButtons getting ignored in preference for empty Screen buttons

* Fixes an issue where on an iPhone X when showing the tab bar on pop from
a scrollable view to a non-scrollable view the root view's bounds
would be incorrect
Simon Mitchell 6 years ago
parent
commit
9d4eea835a
1 changed files with 11 additions and 2 deletions
  1. 11
    2
      ios/RCCViewController.m

+ 11
- 2
ios/RCCViewController.m View File

27
 @property (nonatomic, strong) NSDictionary *originalNavBarImages;
27
 @property (nonatomic, strong) NSDictionary *originalNavBarImages;
28
 @property (nonatomic, strong) UIImageView *navBarHairlineImageView;
28
 @property (nonatomic, strong) UIImageView *navBarHairlineImageView;
29
 @property (nonatomic, weak) id <UIGestureRecognizerDelegate> originalInteractivePopGestureDelegate;
29
 @property (nonatomic, weak) id <UIGestureRecognizerDelegate> originalInteractivePopGestureDelegate;
30
+@property (nonatomic, strong) RCTRootView *rootView;
30
 @end
31
 @end
31
 
32
 
32
 @implementation RCCViewController
33
 @implementation RCCViewController
164
 }
165
 }
165
 
166
 
166
 - (void)commonInit:(RCTRootView*)reactView navigatorStyle:(NSDictionary*)navigatorStyle props:(NSDictionary*)props {
167
 - (void)commonInit:(RCTRootView*)reactView navigatorStyle:(NSDictionary*)navigatorStyle props:(NSDictionary*)props {
167
-    self.view = reactView;
168
+    
169
+    self.rootView = reactView;
170
+    [self.view addSubview: reactView];
168
     
171
     
169
     self.edgesForExtendedLayout = UIRectEdgeNone; // default
172
     self.edgesForExtendedLayout = UIRectEdgeNone; // default
170
     self.automaticallyAdjustsScrollViewInsets = NO; // default
173
     self.automaticallyAdjustsScrollViewInsets = NO; // default
301
     [self setStyleOnDisappear];
304
     [self setStyleOnDisappear];
302
 }
305
 }
303
 
306
 
307
+- (void)viewDidLayoutSubviews
308
+{
309
+    [super viewDidLayoutSubviews];
310
+    self.rootView.frame = self.view.bounds;
311
+}
312
+
304
 // most styles should be set here since when we pop a view controller that changed them
313
 // most styles should be set here since when we pop a view controller that changed them
305
 // we want to reset the style to what we expect (so we need to reset on every willAppear)
314
 // we want to reset the style to what we expect (so we need to reset on every willAppear)
306
 - (void)setStyleOnAppear {
315
 - (void)setStyleOnAppear {
792
                 UIViewController *viewController = (UIViewController*)obj;
801
                 UIViewController *viewController = (UIViewController*)obj;
793
                 [self addChildViewController:viewController];
802
                 [self addChildViewController:viewController];
794
                 viewController.view.frame = self.view.bounds;
803
                 viewController.view.frame = self.view.bounds;
795
-                [self.view addSubview:viewController.view];
804
+                [self.rootView addSubview:viewController.view];
796
                 [viewController didMoveToParentViewController:self];
805
                 [viewController didMoveToParentViewController:self];
797
             } else {
806
             } else {
798
                 NSLog(@"addExternalVCIfNecessary: could not create instance. Make sure that your class is a UIViewController whihc confirms to RCCExternalViewControllerProtocol");
807
                 NSLog(@"addExternalVCIfNecessary: could not create instance. Make sure that your class is a UIViewController whihc confirms to RCCExternalViewControllerProtocol");