|
@@ -135,5 +135,64 @@
|
135
|
135
|
return [NSString stringWithFormat:@"%lld", milliseconds];
|
136
|
136
|
}
|
137
|
137
|
|
|
138
|
++ (NSArray *)getAllSubviewsForView:(UIView *)view {
|
|
139
|
+ NSMutableArray *allSubviews = [NSMutableArray new];
|
|
140
|
+ for (UIView *subview in view.subviews)
|
|
141
|
+ {
|
|
142
|
+ [allSubviews addObject:subview];
|
|
143
|
+ [allSubviews addObjectsFromArray:[self getAllSubviewsForView:subview]];
|
|
144
|
+ }
|
|
145
|
+ return allSubviews;
|
|
146
|
+}
|
|
147
|
+
|
|
148
|
+/*
|
|
149
|
+ The YellowBox is added to each RCTRootView. Regardless if there are warnings or not, if there's a warning anywhere in the app - it is added
|
|
150
|
+ Since it is always appears on the top, it blocks interactions with other components.
|
|
151
|
+ It is most noticeable in RCCLightBox and RCCNotification where button (for example) are not clickable if placed at the bottom part of the view
|
|
152
|
+ */
|
|
153
|
+
|
|
154
|
++ (BOOL)removeYellowBox:(RCTRootView *)reactRootView {
|
|
155
|
+#ifndef DEBUG
|
|
156
|
+ return YES;
|
|
157
|
+#endif
|
|
158
|
+
|
|
159
|
+ BOOL removed = NO;
|
|
160
|
+
|
|
161
|
+ NSArray* subviews = [self getAllSubviewsForView:reactRootView];
|
|
162
|
+ for (UIView *view in subviews)
|
|
163
|
+ {
|
|
164
|
+ if ([view isKindOfClass:[RCTView class]])
|
|
165
|
+ {
|
|
166
|
+ CGFloat r, g, b, a;
|
|
167
|
+ [view.backgroundColor getRed:&r green:&g blue:&b alpha:&a];
|
|
168
|
+
|
|
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))
|
|
171
|
+ {
|
|
172
|
+ UIView *yelloboxParentView = view;
|
|
173
|
+ while (view.superview != nil)
|
|
174
|
+ {
|
|
175
|
+ yelloboxParentView = yelloboxParentView.superview;
|
|
176
|
+ if ([yelloboxParentView isKindOfClass:[RCTScrollView class]])
|
|
177
|
+ {
|
|
178
|
+ yelloboxParentView = yelloboxParentView.superview;
|
|
179
|
+ break;
|
|
180
|
+ }
|
|
181
|
+ }
|
|
182
|
+
|
|
183
|
+ [yelloboxParentView removeFromSuperview];
|
|
184
|
+ removed = YES;
|
|
185
|
+ break;
|
|
186
|
+ }
|
|
187
|
+ }
|
|
188
|
+
|
|
189
|
+ if (removed)
|
|
190
|
+ {
|
|
191
|
+ break;
|
|
192
|
+ }
|
|
193
|
+ }
|
|
194
|
+
|
|
195
|
+ return removed;
|
|
196
|
+}
|
138
|
197
|
|
139
|
198
|
@end
|