Procházet zdrojové kódy

fix buttons mergings

yogevbd před 6 roky
rodič
revize
4cd79d85b7
1 změnil soubory, kde provedl 31 přidání a 27 odebrání
  1. 31
    27
      lib/ios/RNNTopBarOptions.m

+ 31
- 27
lib/ios/RNNTopBarOptions.m Zobrazit soubor

@@ -118,7 +118,7 @@ extern const NSInteger BLUR_TOPBAR_TAG;
118 118
 	} else {
119 119
 		viewController.navigationController.navigationBar.barStyle = UIBarStyleDefault;
120 120
 	}
121
-
121
+	
122 122
 	if (self.translucent) {
123 123
 		viewController.navigationController.navigationBar.translucent = [self.translucent boolValue];
124 124
 	} else {
@@ -155,35 +155,27 @@ extern const NSInteger BLUR_TOPBAR_TAG;
155 155
 	}
156 156
 }
157 157
 
158
-- (void)setLeftButtons:(id)leftButtons {
159
-	if (self.leftButtonColor) {
160
-		_leftButtonStyle.color = self.leftButtonColor;
161
-	}
162
-	
163
-	if (self.leftButtonDisabledColor) {
164
-		_leftButtonStyle.disabledColor = self.leftButtonDisabledColor;
165
-	}
166
-	
167
-	if ([leftButtons isKindOfClass:[NSArray class]]) {
168
-		_leftButtons = leftButtons;
169
-	} else if ([leftButtons isKindOfClass:[NSDictionary class]]) {
170
-		if (leftButtons[@"id"]) {
171
-			_leftButtons = @[leftButtons];
172
-		} else {
173
-			[_leftButtonStyle mergeWith:leftButtons];
174
-		}
175
-	}
158
+- (void)setRightButtonColor:(NSNumber *)rightButtonColor {
159
+	_rightButtonColor = rightButtonColor;
160
+	_rightButtonStyle.color = rightButtonColor;
161
+}
162
+
163
+- (void)setRightButtonDisabledColor:(NSNumber *)rightButtonDisabledColor {
164
+	_rightButtonDisabledColor = rightButtonDisabledColor;
165
+	_rightButtonStyle.disabledColor = rightButtonDisabledColor;
166
+}
167
+
168
+- (void)setLeftButtonColor:(NSNumber *)leftButtonColor {
169
+	_leftButtonColor = leftButtonColor;
170
+	_leftButtonStyle.color = leftButtonColor;
171
+}
172
+
173
+- (void)setLeftButtonDisabledColor:(NSNumber *)leftButtonDisabledColor {
174
+	_leftButtonDisabledColor = leftButtonDisabledColor;
175
+	_leftButtonStyle.disabledColor = leftButtonDisabledColor;
176 176
 }
177 177
 
178 178
 - (void)setRightButtons:(id)rightButtons {
179
-	if (self.rightButtonColor) {
180
-		_rightButtonStyle.color = self.rightButtonColor;
181
-	}
182
-	
183
-	if (self.rightButtonDisabledColor) {
184
-		_rightButtonStyle.disabledColor = self.rightButtonDisabledColor;
185
-	}
186
-	
187 179
 	if ([rightButtons isKindOfClass:[NSArray class]]) {
188 180
 		_rightButtons = rightButtons;
189 181
 	} else if ([rightButtons isKindOfClass:[NSDictionary class]]) {
@@ -195,6 +187,18 @@ extern const NSInteger BLUR_TOPBAR_TAG;
195 187
 	}
196 188
 }
197 189
 
190
+- (void)setLeftButtons:(id)leftButtons {
191
+	if ([leftButtons isKindOfClass:[NSArray class]]) {
192
+		_leftButtons = leftButtons;
193
+	} else if ([leftButtons isKindOfClass:[NSDictionary class]]) {
194
+		if (leftButtons[@"id"]) {
195
+			_leftButtons = @[leftButtons];
196
+		} else {
197
+			[_leftButtonStyle mergeWith:leftButtons];
198
+		}
199
+	}
200
+}
201
+
198 202
 -(void)storeOriginalTopBarImages:(UIViewController*)viewController {
199 203
 	NSMutableDictionary *originalTopBarImages = [@{} mutableCopy];
200 204
 	UIImage *bgImage = [viewController.navigationController.navigationBar backgroundImageForBarMetrics:UIBarMetricsDefault];