Browse Source

Fix applying drawBehind through mergeOptions (#5951)

mergeOptions did not handle bottomTabs.drawBehind options properly - the ReactRootView wasn't remeasured.
Yogev Ben David 4 years ago
parent
commit
e002a68110
No account linked to committer's email address
2 changed files with 16 additions and 2 deletions
  1. 6
    2
      lib/ios/RNNComponentPresenter.m
  2. 10
    0
      lib/ios/UIViewController+RNNOptions.m

+ 6
- 2
lib/ios/RNNComponentPresenter.m View File

118
 
118
 
119
 	if (options.topBar.drawBehind.hasValue) {
119
 	if (options.topBar.drawBehind.hasValue) {
120
 		[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
120
 		[viewController setDrawBehindTopBar:options.topBar.drawBehind.get];
121
-  }
121
+    }
122
+    
123
+    if (options.bottomTabs.drawBehind.hasValue) {
124
+        [viewController setDrawBehindTabBar:options.bottomTabs.drawBehind.get];
125
+    }
122
 
126
 
123
-  if (options.topBar.title.text.hasValue) {
127
+    if (options.topBar.title.text.hasValue) {
124
 		[viewController setNavigationItemTitle:options.topBar.title.text.get];
128
 		[viewController setNavigationItemTitle:options.topBar.title.text.get];
125
 	}
129
 	}
126
 
130
 

+ 10
- 0
lib/ios/UIViewController+RNNOptions.m View File

62
 	} else {
62
 	} else {
63
 		self.edgesForExtendedLayout &= ~UIRectEdgeTop;
63
 		self.edgesForExtendedLayout &= ~UIRectEdgeTop;
64
 	}
64
 	}
65
+    
66
+    if (self.isViewLoaded) {
67
+        [self.view setNeedsLayout];
68
+        [self.view layoutIfNeeded];
69
+    }
65
 }
70
 }
66
 
71
 
67
 - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
72
 - (void)setDrawBehindTabBar:(BOOL)drawBehindTabBar {
70
 	} else {
75
 	} else {
71
 		self.edgesForExtendedLayout &= ~UIRectEdgeBottom;
76
 		self.edgesForExtendedLayout &= ~UIRectEdgeBottom;
72
 	}
77
 	}
78
+    
79
+    if (self.isViewLoaded) {
80
+        [self.view setNeedsLayout];
81
+        [self.view layoutIfNeeded];
82
+    }
73
 }
83
 }
74
 
84
 
75
 - (void)setTabBarItemBadge:(NSString *)badge {
85
 - (void)setTabBarItemBadge:(NSString *)badge {