소스 검색

fix header alignment

yogevbd 6 년 전
부모
커밋
b8945a26d5
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5
    2
      lib/ios/RNNRootViewController.m

+ 5
- 2
lib/ios/RNNRootViewController.m 파일 보기

@@ -10,6 +10,7 @@
10 10
 	RNNReactRootView* _customTitleView;
11 11
 	UIView* _customTopBar;
12 12
 	UIView* _customTopBarBackground;
13
+	BOOL _isBeingPresented;
13 14
 }
14 15
 
15 16
 @property (nonatomic, strong) NSString* componentName;
@@ -60,6 +61,7 @@
60 61
 
61 62
 -(void)viewWillAppear:(BOOL)animated{
62 63
 	[super viewWillAppear:animated];
64
+	_isBeingPresented = YES;
63 65
 	[self.options applyOn:self];
64 66
 }
65 67
 
@@ -70,6 +72,7 @@
70 72
 
71 73
 - (void)viewWillDisappear:(BOOL)animated {
72 74
 	[super viewWillDisappear:animated];
75
+	_isBeingPresented = NO;
73 76
 }
74 77
 
75 78
 -(void)viewDidDisappear:(BOOL)animated {
@@ -136,14 +139,14 @@
136 139
 }
137 140
 
138 141
 - (void)setCustomNavigationTitleView {
139
-	if (!_customTitleView) {
142
+	if (!_customTitleView && _isBeingPresented) {
140 143
 		if (self.options.topBar.title.component.name) {
141 144
 			_customTitleView = (RNNReactRootView*)[_creator createRootViewFromComponentOptions:self.options.topBar.title.component];
142 145
 			_customTitleView.backgroundColor = UIColor.clearColor;
143 146
 			[_customTitleView setAlignment:self.options.topBar.title.component.alignment];
144 147
 			BOOL isCenter = [self.options.topBar.title.component.alignment isEqualToString:@"center"];
145 148
 			__weak RNNReactRootView *weakTitleView = _customTitleView;
146
-			CGRect frame = self.navigationController.navigationBar.frame;
149
+			CGRect frame = self.navigationController.navigationBar.bounds;
147 150
 			[_customTitleView setFrame:frame];
148 151
 			[_customTitleView setRootViewDidChangeIntrinsicSize:^(CGSize intrinsicContentSize) {
149 152
 				if (isCenter) {