mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-01 22:42:48 +08:00
34 lines
511 B
Objective-C
34 lines
511 B
Objective-C
#import <React/RCTViewManager.h>
|
|
|
|
@interface RNSLifecycleAwareView : UIView
|
|
@end
|
|
|
|
@implementation RNSLifecycleAwareView
|
|
|
|
- (void)didMoveToWindow
|
|
{
|
|
[super didMoveToWindow];
|
|
BOOL isVisible = self.superview && self.window;
|
|
if (isVisible) {
|
|
NSLog(@"ATTACHED");
|
|
} else {
|
|
NSLog(@"DETTACHED");
|
|
}
|
|
}
|
|
|
|
@end
|
|
|
|
@interface RNSLifecycleAwareViewManager : RCTViewManager
|
|
@end
|
|
|
|
@implementation RNSLifecycleAwareViewManager
|
|
|
|
RCT_EXPORT_MODULE()
|
|
|
|
- (UIView *)view
|
|
{
|
|
return [RNSLifecycleAwareView new];
|
|
}
|
|
|
|
@end
|