|
@@ -11,46 +11,24 @@ const NSInteger BLUR_STATUS_TAG = 78264801;
|
11
|
11
|
const NSInteger BLUR_TOPBAR_TAG = 78264802;
|
12
|
12
|
const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
|
13
|
13
|
|
14
|
|
-@implementation RNNNavigationOptions
|
|
14
|
+@implementation RCTConvert (UIModalPresentationStyle)
|
15
|
15
|
|
16
|
|
--(instancetype)init {
|
17
|
|
- return [self initWithDict:@{}];
|
18
|
|
-}
|
|
16
|
+RCT_ENUM_CONVERTER(UIModalPresentationStyle,
|
|
17
|
+ (@{@"fullScreen": @(UIModalPresentationFullScreen),
|
|
18
|
+ @"pageSheet": @(UIModalPresentationPageSheet),
|
|
19
|
+ @"formSheet": @(UIModalPresentationFormSheet),
|
|
20
|
+ @"currentContext": @(UIModalPresentationCurrentContext),
|
|
21
|
+ @"custom": @(UIModalPresentationCustom),
|
|
22
|
+ @"overFullScreen": @(UIModalPresentationOverFullScreen),
|
|
23
|
+ @"overCurrentContext": @(UIModalPresentationOverCurrentContext),
|
|
24
|
+ @"popover": @(UIModalPresentationPopover),
|
|
25
|
+ @"none": @(UIModalPresentationNone)
|
|
26
|
+ }), UIModalPresentationFullScreen, integerValue)
|
19
|
27
|
|
20
|
|
--(instancetype)initWithDict:(NSDictionary *)options {
|
21
|
|
- self = [super init];
|
22
|
|
- self.statusBarHidden = [options objectForKey:@"statusBarHidden"];
|
23
|
|
- self.statusBarBlur = [options objectForKey:@"statusBarBlur"];
|
24
|
|
- self.statusBarStyle = [options objectForKey:@"statusBarStyle"];
|
25
|
|
- self.screenBackgroundColor = [options objectForKey:@"screenBackgroundColor"];
|
26
|
|
- self.backButtonTransition = [options objectForKey:@"backButtonTransition"];
|
27
|
|
- self.orientation = [options objectForKey:@"orientation"];
|
28
|
|
- self.topBar = [[RNNTopBarOptions alloc] initWithDict:[options objectForKey:@"topBar"]];
|
29
|
|
- self.topTab = [[RNNTopTabOptions alloc] initWithDict:[options objectForKey:@"topTab"]];
|
30
|
|
- self.bottomTabs = [[RNNBottomTabsOptions alloc] initWithDict:[options objectForKey:@"bottomTabs"]];
|
31
|
|
- self.sideMenu = [[RNNSideMenuOptions alloc] initWithDict:[options objectForKey:@"sideMenu"]];
|
32
|
|
- self.backgroundImage = [RCTConvert UIImage:[options objectForKey:@"backgroundImage"]];
|
33
|
|
- self.rootBackgroundImage = [RCTConvert UIImage:[options objectForKey:@"rootBackgroundImage"]];
|
34
|
|
- self.bottomTab = [[RNNBottomTabOptions alloc] initWithDict:[options objectForKey:@"bottomTab"]];
|
35
|
|
- self.overlay = [[RNNOverlayOptions alloc] initWithDict:[options objectForKey:@"overlay"]];
|
36
|
|
- self.customTransition = [[RNNAnimationOptions alloc] initWithDict:[options objectForKey:@"customTransition"]];
|
37
|
|
- self.animations = [[RNNTransitionsOptions alloc] initWithDict:[options objectForKey:@"animations"]];
|
|
28
|
+@end
|
38
|
29
|
|
39
|
|
- return self;
|
40
|
|
-}
|
|
30
|
+@implementation RNNNavigationOptions
|
41
|
31
|
|
42
|
|
--(void)mergeWith:(NSDictionary *)otherOptions {
|
43
|
|
- for (id key in otherOptions) {
|
44
|
|
- if ([self hasProperty:key]) {
|
45
|
|
- if ([[self valueForKey:key] isKindOfClass:[RNNOptions class]]) {
|
46
|
|
- RNNOptions* options = [self valueForKey:key];
|
47
|
|
- [options mergeWith:[otherOptions objectForKey:key]];
|
48
|
|
- } else {
|
49
|
|
- [self setValue:[otherOptions objectForKey:key] forKey:key];
|
50
|
|
- }
|
51
|
|
- }
|
52
|
|
- }
|
53
|
|
-}
|
54
|
32
|
|
55
|
33
|
-(void)applyOn:(UIViewController<RNNRootViewProtocol> *)viewController {
|
56
|
34
|
[self.topBar applyOn:viewController];
|
|
@@ -98,7 +76,7 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
|
98
|
76
|
}
|
99
|
77
|
|
100
|
78
|
backgroundImageView.layer.masksToBounds = YES;
|
101
|
|
- backgroundImageView.image = self.backgroundImage;
|
|
79
|
+ backgroundImageView.image = [RCTConvert UIImage:self.backgroundImage];
|
102
|
80
|
[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
|
103
|
81
|
}
|
104
|
82
|
|
|
@@ -110,9 +88,13 @@ const NSInteger TOP_BAR_TRANSPARENT_TAG = 78264803;
|
110
|
88
|
}
|
111
|
89
|
|
112
|
90
|
backgroundImageView.layer.masksToBounds = YES;
|
113
|
|
- backgroundImageView.image = self.rootBackgroundImage;
|
|
91
|
+ backgroundImageView.image = [RCTConvert UIImage:self.rootBackgroundImage];
|
114
|
92
|
[backgroundImageView setContentMode:UIViewContentModeScaleAspectFill];
|
115
|
93
|
}
|
|
94
|
+
|
|
95
|
+ if (self.modalPresentationStyle) {
|
|
96
|
+ viewController.modalPresentationStyle = [RCTConvert UIModalPresentationStyle:self.modalPresentationStyle];
|
|
97
|
+ }
|
116
|
98
|
}
|
117
|
99
|
|
118
|
100
|
- (UIInterfaceOrientationMask)supportedOrientations {
|