File tree Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Expand file tree Collapse file tree 1 file changed +38
-2
lines changed Original file line number Diff line number Diff line change 1
1
#import " RNNComponentView.h"
2
2
#import " RCTHelpers.h"
3
3
4
- @implementation RNNComponentView
4
+ @implementation RNNComponentView {
5
+ BOOL _observeLayerChange;
6
+ }
5
7
6
8
- (void )layoutSubviews {
7
9
[super layoutSubviews ];
8
10
#ifdef DEBUG
9
- [RCTHelpers removeYellowBox: self ];
11
+ [self removeYellowBox ];
10
12
#endif
11
13
}
12
14
15
+ #ifdef DEBUG
16
+ - (void )removeYellowBox {
17
+ if (self.subviews .count > 0 && self.subviews .firstObject .subviews .count > 0 ) {
18
+ if (!_observeLayerChange) {
19
+ [self .subviews.firstObject.subviews.firstObject.layer
20
+ addObserver: self
21
+ forKeyPath: @" sublayers"
22
+ options: NSKeyValueObservingOptionNew
23
+ context: nil ];
24
+ _observeLayerChange = YES ;
25
+ }
26
+
27
+ for (UIView *view in self.subviews .firstObject .subviews .firstObject .subviews ) {
28
+ if ([view.accessibilityLabel isEqualToString: @" ! Yellow Box" ]) {
29
+ view.layer .opacity = 0 ;
30
+ view.layer .zPosition = -100 ;
31
+ }
32
+ }
33
+ }
34
+ }
35
+
36
+ - (void )observeValueForKeyPath : (NSString *)keyPath
37
+ ofObject : (id )object
38
+ change : (NSDictionary *)change
39
+ context : (void *)context {
40
+ if ([keyPath isEqualToString: @" sublayers" ]) {
41
+ if (((CALayer *)object).sublayers .count > 1 ) {
42
+ ((CALayer *)object).sublayers .lastObject .opacity = 0 ;
43
+ ((CALayer *)object).sublayers .lastObject .zPosition = -100 ;
44
+ }
45
+ }
46
+ }
47
+ #endif
48
+
13
49
@end
You can’t perform that action at this time.
0 commit comments