Browse Source

[v2][iOS] Fix display empty custom topBar background over valid custom background (#4823)

* [V2] [iOS] Fix iOS custom topBar background component

* Revert "[V2] [iOS] Fix iOS custom topBar background component"

This reverts commit aab340dbf5.

* Remove previous customTopBar and customTopBarBackground before new one
RoTTex 5 years ago
parent
commit
6cb1e18a88
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      lib/ios/RNNNavigationControllerPresenter.m

+ 6
- 0
lib/ios/RNNNavigationControllerPresenter.m View File

@@ -181,6 +181,9 @@
181 181
 	if (options.topBar.component.name.hasValue) {
182 182
 		RCTRootView *reactView = [_componentRegistry createComponentIfNotExists:options.topBar.component parentComponentId:navigationController.layoutInfo.componentId reactViewReadyBlock:readyBlock];
183 183
 		
184
+		if (_customTopBar) {
185
+			[_customTopBar removeFromSuperview];
186
+		}
184 187
 		_customTopBar = [[RNNCustomTitleView alloc] initWithFrame:navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
185 188
 		reactView.backgroundColor = UIColor.clearColor;
186 189
 		_customTopBar.backgroundColor = UIColor.clearColor;
@@ -202,6 +205,9 @@
202 205
 	if (options.topBar.background.component.name.hasValue) {
203 206
 		RCTRootView *reactView = [_componentRegistry createComponentIfNotExists:options.topBar.background.component parentComponentId:navigationController.layoutInfo.componentId reactViewReadyBlock:readyBlock];
204 207
 		
208
+		if (_customTopBarBackground) {
209
+			[_customTopBarBackground removeFromSuperview];
210
+		}
205 211
 		_customTopBarBackground = [[RNNCustomTitleView alloc] initWithFrame:navigationController.navigationBar.bounds subView:reactView alignment:@"fill"];
206 212
 		[navigationController.navigationBar insertSubview:_customTopBarBackground atIndex:1];
207 213
 	} else {