mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-09 17:23:18 +08:00
77 lines
1.1 KiB
Objective-C
77 lines
1.1 KiB
Objective-C
#import "RNSScreen.h"
|
|
#import "RNSScreenContainer.h"
|
|
|
|
@interface RNSScreen : UIViewController
|
|
|
|
- (instancetype)initWithView:(UIView *)view;
|
|
|
|
@end
|
|
|
|
@implementation RNSScreenView
|
|
|
|
- (instancetype)init
|
|
{
|
|
if (self = [super init]) {
|
|
_controller = [[RNSScreen alloc] initWithView:self];
|
|
_controller.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)setActive:(BOOL)active
|
|
{
|
|
_active = active;
|
|
[_reactSuperview markChildUpdated];
|
|
}
|
|
|
|
- (UIView *)reactSuperview
|
|
{
|
|
return _reactSuperview;
|
|
}
|
|
|
|
- (void)didSetProps:(NSArray<NSString *> *)changedProps
|
|
{
|
|
[_reactSuperview didUpdateChildren];
|
|
}
|
|
|
|
- (void)invalidate
|
|
{
|
|
_controller.view = nil;
|
|
_controller = nil;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation RNSScreen {
|
|
__weak UIView *_view;
|
|
}
|
|
|
|
- (instancetype)initWithView:(UIView *)view
|
|
{
|
|
if (self = [super init]) {
|
|
_view = view;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)loadView
|
|
{
|
|
self.view = _view;
|
|
_view = nil;
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation RNSScreenManager
|
|
|
|
RCT_EXPORT_MODULE()
|
|
|
|
RCT_EXPORT_VIEW_PROPERTY(active, BOOL)
|
|
|
|
- (UIView *)view
|
|
{
|
|
return [[RNSScreenView alloc] init];
|
|
}
|
|
|
|
@end
|