Browse Source

Remove yellow boxes from title and button components in debug (#5819)

Yogev Ben David 5 years ago
parent
commit
b82d87f0c8
No account linked to committer's email address
2 changed files with 8 additions and 7 deletions
  1. 1
    1
      lib/ios/RCTHelpers.m
  2. 7
    6
      lib/ios/RNNReactView.m

+ 1
- 1
lib/ios/RCTHelpers.m View File

167
 			[view.backgroundColor getRed:&r green:&g blue:&b alpha:&a];
167
 			[view.backgroundColor getRed:&r green:&g blue:&b alpha:&a];
168
 			
168
 			
169
 			//identify the yellow view by its hard-coded color and height
169
 			//identify the yellow view by its hard-coded color and height
170
-			if((lrint(r * 255) == 250) && (lrint(g * 255) == 186) && (lrint(b * 255) == 48) && (lrint(a * 100) == 95) && (view.frame.size.height == 46))
170
+			if((lrint(r * 255) == 250) && (lrint(g * 255) == 186) && (lrint(b * 255) == 48) && (lrint(a * 100) == 95) && (view.frame.size.height == 48))
171
 			{
171
 			{
172
 				UIView *yelloboxParentView = view;
172
 				UIView *yelloboxParentView = view;
173
 				while (view.superview != nil)
173
 				while (view.superview != nil)

+ 7
- 6
lib/ios/RNNReactView.m View File

14
 	return self;
14
 	return self;
15
 }
15
 }
16
 
16
 
17
+- (void)layoutSubviews {
18
+    [super layoutSubviews];
19
+    #ifdef DEBUG
20
+        [RCTHelpers removeYellowBox:self];
21
+    #endif
22
+}
23
+
17
 - (void)contentDidAppear:(NSNotification *)notification {
24
 - (void)contentDidAppear:(NSNotification *)notification {
18
-#ifdef DEBUG
19
-	if ([((RNNReactView *)notification.object).moduleName isEqualToString:self.moduleName]) {
20
-		[RCTHelpers removeYellowBox:self];
21
-	}
22
-#endif
23
-	
24
 	RNNReactView* appearedView = notification.object;
25
 	RNNReactView* appearedView = notification.object;
25
 	
26
 	
26
 	 if (_reactViewReadyBlock && [appearedView.appProperties[@"componentId"] isEqual:self.componentId]) {
27
 	 if (_reactViewReadyBlock && [appearedView.appProperties[@"componentId"] isEqual:self.componentId]) {