Bläddra i källkod

[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 år sedan
förälder
incheckning
6cb1e18a88
1 ändrade filer med 6 tillägg och 0 borttagningar
  1. 6
    0
      lib/ios/RNNNavigationControllerPresenter.m

+ 6
- 0
lib/ios/RNNNavigationControllerPresenter.m Visa fil

@@ -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 {