hybrid-navigation 2.17.4 → 2.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +26 -3
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +20 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactStackFragment.java +15 -0
- package/ios/HybridNavigation/GlobalStyle.h +1 -0
- package/ios/HybridNavigation/GlobalStyle.m +1 -0
- package/ios/HybridNavigation/HybridNavigation.h +1 -0
- package/ios/HybridNavigation/Navigator/HBDStackNavigator.m +97 -14
- package/ios/HybridNavigation/View/UITabBar+Badge.m +4 -4
- package/ios/HybridNavigation/ViewController/HBDViewController.h +1 -0
- package/ios/HybridNavigation/ViewController/HBDViewController.m +56 -0
- package/ios/HybridNavigation/ViewController/UINavigationController+HBD.m +1 -1
- package/lib/Options.d.ts +2 -0
- package/package.json +1 -1
- package/src/Options.ts +2 -0
package/android/build.gradle
CHANGED
|
@@ -33,5 +33,5 @@ dependencies {
|
|
|
33
33
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
34
34
|
implementation 'com.facebook.react:react-native:+'
|
|
35
35
|
// api project(':navigation')
|
|
36
|
-
api 'io.github.listenzz:AndroidNavigation:13.6.
|
|
36
|
+
api 'io.github.listenzz:AndroidNavigation:13.6.9'
|
|
37
37
|
}
|
|
@@ -38,7 +38,7 @@ public class HybridFragment extends AwesomeFragment {
|
|
|
38
38
|
public ReactBridgeManager getReactBridgeManager() {
|
|
39
39
|
return bridgeManager;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
public boolean isReactModuleRegisterCompleted() {
|
|
43
43
|
return bridgeManager.isReactModuleRegisterCompleted();
|
|
44
44
|
}
|
|
@@ -98,7 +98,7 @@ public class HybridFragment extends AwesomeFragment {
|
|
|
98
98
|
super.onViewCreated(view, savedInstanceState);
|
|
99
99
|
garden.setupToolbar();
|
|
100
100
|
}
|
|
101
|
-
|
|
101
|
+
|
|
102
102
|
@NonNull
|
|
103
103
|
@Override
|
|
104
104
|
protected BarStyle preferredStatusBarStyle() {
|
|
@@ -107,12 +107,25 @@ public class HybridFragment extends AwesomeFragment {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
if (getPresentationStyle() == PresentationStyle.OverFullScreen) {
|
|
110
|
-
return
|
|
110
|
+
return SystemUI.activityStatusBarStyle(requireActivity());
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
return super.preferredStatusBarStyle();
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
@Override
|
|
117
|
+
protected boolean preferredStatusBarHidden() {
|
|
118
|
+
if (forceTransparentDialogWindow()) {
|
|
119
|
+
return SystemUI.isStatusBarHidden(requireActivity().getWindow());
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (getPresentationStyle() == PresentationStyle.OverFullScreen) {
|
|
123
|
+
return SystemUI.isStatusBarHidden(requireActivity().getWindow());
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return super.preferredStatusBarHidden();
|
|
127
|
+
}
|
|
128
|
+
|
|
116
129
|
@Override
|
|
117
130
|
protected boolean preferredNavigationBarHidden() {
|
|
118
131
|
if (getPresentationStyle() == PresentationStyle.OverFullScreen) {
|
|
@@ -167,6 +180,16 @@ public class HybridFragment extends AwesomeFragment {
|
|
|
167
180
|
return options.getBoolean("passThroughTouches");
|
|
168
181
|
}
|
|
169
182
|
|
|
183
|
+
protected boolean shouldAnimatedTransition() {
|
|
184
|
+
Bundle options = getOptions();
|
|
185
|
+
return options.getBoolean("animatedTransition", true);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
protected boolean forceScreenLandscape() {
|
|
189
|
+
Bundle options = getOptions();
|
|
190
|
+
return options.getBoolean("forceScreenLandscape", false);
|
|
191
|
+
}
|
|
192
|
+
|
|
170
193
|
protected boolean forceTransparentDialogWindow() {
|
|
171
194
|
return garden.forceTransparentDialogWindow;
|
|
172
195
|
}
|
|
@@ -12,6 +12,7 @@ import static com.reactnative.hybridnavigation.HBDEventEmitter.ON_COMPONENT_APPE
|
|
|
12
12
|
import static com.reactnative.hybridnavigation.HBDEventEmitter.ON_COMPONENT_DISAPPEAR;
|
|
13
13
|
import static com.reactnative.hybridnavigation.HBDEventEmitter.ON_COMPONENT_RESULT;
|
|
14
14
|
|
|
15
|
+
import android.content.pm.ActivityInfo;
|
|
15
16
|
import android.graphics.Color;
|
|
16
17
|
import android.os.Bundle;
|
|
17
18
|
import android.view.Gravity;
|
|
@@ -23,6 +24,7 @@ import androidx.annotation.NonNull;
|
|
|
23
24
|
import androidx.annotation.Nullable;
|
|
24
25
|
import androidx.appcompat.widget.Toolbar;
|
|
25
26
|
|
|
27
|
+
import com.facebook.common.logging.FLog;
|
|
26
28
|
import com.facebook.react.ReactInstanceManager;
|
|
27
29
|
import com.facebook.react.bridge.Arguments;
|
|
28
30
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -132,6 +134,23 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
|
|
|
132
134
|
unmountReactView();
|
|
133
135
|
}
|
|
134
136
|
|
|
137
|
+
@Override
|
|
138
|
+
public void onStart() {
|
|
139
|
+
super.onStart();
|
|
140
|
+
if (forceScreenLandscape()) {
|
|
141
|
+
requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
@Override
|
|
146
|
+
public void onStop() {
|
|
147
|
+
super.onStop();
|
|
148
|
+
if (forceScreenLandscape() && isRemoving()) {
|
|
149
|
+
requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
|
|
150
|
+
unmountReactView();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
135
154
|
@Override
|
|
136
155
|
public void onReload() {
|
|
137
156
|
unmountReactView();
|
|
@@ -151,6 +170,7 @@ public class ReactFragment extends HybridFragment implements ReactBridgeManager.
|
|
|
151
170
|
}
|
|
152
171
|
|
|
153
172
|
if (reactRootView != null) {
|
|
173
|
+
FLog.w(TAG, "销毁页面:" + getModuleName());
|
|
154
174
|
reactRootView.unmountReactApplication();
|
|
155
175
|
ViewGroup parent = (ViewGroup) reactRootView.getParent();
|
|
156
176
|
parent.removeView(reactRootView);
|
|
@@ -42,6 +42,11 @@ public class ReactStackFragment extends StackFragment {
|
|
|
42
42
|
protected void pushFragmentSync(AwesomeFragment fragment, @NonNull Runnable completion, @NonNull TransitionAnimation animation) {
|
|
43
43
|
if (fragment instanceof ReactFragment) {
|
|
44
44
|
ReactFragment reactFragment = (ReactFragment) fragment;
|
|
45
|
+
if (!reactFragment.shouldAnimatedTransition()) {
|
|
46
|
+
super.pushFragmentSync(fragment, completion, TransitionAnimation.None);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
45
50
|
if (reactFragment.shouldPassThroughTouches()) {
|
|
46
51
|
super.pushFragmentSync(fragment, completion, BetterPush);
|
|
47
52
|
return;
|
|
@@ -55,6 +60,11 @@ public class ReactStackFragment extends StackFragment {
|
|
|
55
60
|
AwesomeFragment topFragment = getTopFragment();
|
|
56
61
|
if (topFragment instanceof ReactFragment) {
|
|
57
62
|
ReactFragment reactFragment = (ReactFragment) topFragment;
|
|
63
|
+
if (!reactFragment.shouldAnimatedTransition()) {
|
|
64
|
+
super.popToFragmentSync(fragment, completion, TransitionAnimation.None);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
if (reactFragment.shouldPassThroughTouches()) {
|
|
59
69
|
super.popToFragmentSync(fragment, completion, BetterPush);
|
|
60
70
|
return;
|
|
@@ -67,6 +77,11 @@ public class ReactStackFragment extends StackFragment {
|
|
|
67
77
|
protected void redirectToFragmentSync(@NonNull AwesomeFragment fragment, @NonNull Runnable completion, @NonNull TransitionAnimation animation, @Nullable AwesomeFragment from) {
|
|
68
78
|
if (fragment instanceof ReactFragment) {
|
|
69
79
|
ReactFragment reactFragment = (ReactFragment) fragment;
|
|
80
|
+
if (!reactFragment.shouldAnimatedTransition()) {
|
|
81
|
+
super.redirectToFragmentSync(fragment, completion, TransitionAnimation.None, from);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
|
|
70
85
|
if (reactFragment.shouldPassThroughTouches()) {
|
|
71
86
|
super.redirectToFragmentSync(fragment, completion, BetterRedirect, from);
|
|
72
87
|
return;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
@property(nonatomic, copy) NSString *tabBarUnselectedItemColorHexString;
|
|
16
16
|
@property(nonatomic, strong, readonly) UIColor *tabBarBackgroundColor;
|
|
17
17
|
@property(nonatomic, assign, readonly) BOOL alwaysSplitNavigationBarTransition;
|
|
18
|
+
@property(nonatomic, assign) UIInterfaceOrientationMask interfaceOrientation;
|
|
18
19
|
|
|
19
20
|
- (instancetype)initWithOptions:(NSDictionary *)options;
|
|
20
21
|
|
|
@@ -57,6 +57,7 @@ static GlobalStyle *globalStyle;
|
|
|
57
57
|
- (instancetype)initWithOptions:(NSDictionary *)options {
|
|
58
58
|
if (self = [super init]) {
|
|
59
59
|
_options = options;
|
|
60
|
+
_interfaceOrientation = UIInterfaceOrientationMaskPortrait;
|
|
60
61
|
|
|
61
62
|
// screenBackgroundColor
|
|
62
63
|
NSString *screenBackgroundColor = options[@"screenBackgroundColor"];
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
if ([action isEqualToString:@"pop"]) {
|
|
91
|
-
[self handlePopWithNavigationController:nav callback:callback];
|
|
91
|
+
[self handlePopWithNavigationController:nav viewController:vc callback:callback];
|
|
92
92
|
return;
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -121,14 +121,37 @@
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
vc.hidesBottomBarWhenPushed = nav.hidesBottomBarWhenPushed;
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
[
|
|
124
|
+
|
|
125
|
+
BOOL animated = YES;
|
|
126
|
+
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
127
|
+
HBDViewController *hdbvc = (HBDViewController *)vc;
|
|
128
|
+
animated = hdbvc.animatedTransition;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (animated) {
|
|
132
|
+
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
133
|
+
[nav pushViewController:vc animated:YES];
|
|
134
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
135
|
+
} else {
|
|
136
|
+
[nav pushViewController:vc animated:NO];
|
|
137
|
+
callback(@[NSNull.null, @YES]);
|
|
138
|
+
}
|
|
127
139
|
}
|
|
128
140
|
|
|
129
|
-
- (void)handlePopWithNavigationController:(UINavigationController *)nav callback:(RCTResponseSenderBlock)callback {
|
|
130
|
-
|
|
131
|
-
[
|
|
141
|
+
- (void)handlePopWithNavigationController:(UINavigationController *)nav viewController:(UIViewController *)vc callback:(RCTResponseSenderBlock)callback {
|
|
142
|
+
BOOL animated = YES;
|
|
143
|
+
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
144
|
+
HBDViewController *hdbvc = (HBDViewController *)vc;
|
|
145
|
+
animated = hdbvc.animatedTransition;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (animated) {
|
|
149
|
+
[nav popViewControllerAnimated:YES];
|
|
150
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
151
|
+
} else {
|
|
152
|
+
[nav popViewControllerAnimated:NO];
|
|
153
|
+
callback(@[NSNull.null, @YES]);
|
|
154
|
+
}
|
|
132
155
|
}
|
|
133
156
|
|
|
134
157
|
- (void)handlePopToWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
@@ -138,8 +161,41 @@
|
|
|
138
161
|
return;
|
|
139
162
|
}
|
|
140
163
|
|
|
141
|
-
[
|
|
142
|
-
|
|
164
|
+
UIViewController *from_vc = [self findFromViewControllerWithNavigationController:nav extras:extras];
|
|
165
|
+
|
|
166
|
+
BOOL animated = YES;
|
|
167
|
+
if ([from_vc isKindOfClass:[HBDViewController class]]) {
|
|
168
|
+
HBDViewController *hbdvc = (HBDViewController *)from_vc;
|
|
169
|
+
animated = hbdvc.animatedTransition;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (animated) {
|
|
173
|
+
[nav popToViewController:vc animated:YES];
|
|
174
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
175
|
+
}else {
|
|
176
|
+
[nav popToViewController:vc animated:NO];
|
|
177
|
+
callback(@[NSNull.null, @YES]);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
- (UIViewController *)findFromViewControllerWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras {
|
|
183
|
+
NSArray *children = nav.childViewControllers;
|
|
184
|
+
NSString *moduleName = extras[@"from"];
|
|
185
|
+
BOOL inclusive = [extras[@"inclusive"] boolValue];
|
|
186
|
+
|
|
187
|
+
for (NSUInteger i = children.count; i > 0; i--) {
|
|
188
|
+
NSUInteger index = i - 1;
|
|
189
|
+
HBDViewController *vc = children[index];
|
|
190
|
+
if ([moduleName isEqualToString:vc.moduleName] || [moduleName isEqualToString:vc.sceneId]) {
|
|
191
|
+
if (inclusive && index > 0) {
|
|
192
|
+
return children[index - 1];
|
|
193
|
+
}
|
|
194
|
+
return vc;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return nil;
|
|
143
199
|
}
|
|
144
200
|
|
|
145
201
|
- (UIViewController *)findViewControllerWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras {
|
|
@@ -162,8 +218,23 @@
|
|
|
162
218
|
}
|
|
163
219
|
|
|
164
220
|
- (void)handlePopToRootWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
165
|
-
|
|
166
|
-
[self
|
|
221
|
+
|
|
222
|
+
UIViewController *from_vc = [self findFromViewControllerWithNavigationController:nav extras:extras];
|
|
223
|
+
|
|
224
|
+
BOOL animated = YES;
|
|
225
|
+
|
|
226
|
+
if ([from_vc isKindOfClass:[HBDViewController class]]) {
|
|
227
|
+
HBDViewController *hbdvc = (HBDViewController *)from_vc;
|
|
228
|
+
animated = hbdvc.animatedTransition;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (animated) {
|
|
232
|
+
[nav popToRootViewControllerAnimated:YES];
|
|
233
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
234
|
+
}else {
|
|
235
|
+
[nav popToRootViewControllerAnimated:NO];
|
|
236
|
+
callback(@[NSNull.null, @YES]);
|
|
237
|
+
}
|
|
167
238
|
}
|
|
168
239
|
|
|
169
240
|
- (void)handleRedirectToWithNavigationController:(UINavigationController *)nav target:(UIViewController *)target extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
@@ -177,10 +248,22 @@
|
|
|
177
248
|
callback(@[NSNull.null, @NO]);
|
|
178
249
|
return;
|
|
179
250
|
}
|
|
251
|
+
BOOL animated = YES;
|
|
252
|
+
|
|
253
|
+
if ([vc isKindOfClass:[HBDViewController class]]) {
|
|
254
|
+
HBDViewController *hbdvc = (HBDViewController *)vc;
|
|
255
|
+
animated = hbdvc.animatedTransition;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (animated) {
|
|
259
|
+
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
260
|
+
[nav redirectToViewController:vc target:target animated:YES];
|
|
261
|
+
[self animateAlongsideTransition:nav callback:callback];
|
|
262
|
+
}else {
|
|
263
|
+
[nav redirectToViewController:vc target:target animated:NO];
|
|
264
|
+
callback(@[NSNull.null, @YES]);
|
|
265
|
+
}
|
|
180
266
|
|
|
181
|
-
[[HBDAnimationObserver sharedObserver] beginAnimation];
|
|
182
|
-
[nav redirectToViewController:vc target:target animated:YES];
|
|
183
|
-
[self animateAlongsideTransition:nav callback:callback];
|
|
184
267
|
}
|
|
185
268
|
|
|
186
269
|
- (void)handlePushLayoutWithNavigationController:(UINavigationController *)nav extras:(NSDictionary *)extras callback:(RCTResponseSenderBlock)callback {
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
label.backgroundColor = [UITabBarItem appearance].badgeColor ?: [UIColor colorWithRed:1 green:58.0 / 255.0 blue:47. / 255. alpha:1];
|
|
12
12
|
|
|
13
13
|
CGFloat percentX = (index + 0.5) / self.items.count;
|
|
14
|
-
CGFloat x = ceilf((float) (percentX * self.frame.size.width +
|
|
15
|
-
CGFloat y =
|
|
14
|
+
CGFloat x = ceilf((float) (percentX * self.frame.size.width + 8));
|
|
15
|
+
CGFloat y = 6;
|
|
16
16
|
//10为小红点的高度和宽度
|
|
17
|
-
label.frame = CGRectMake(x, y,
|
|
17
|
+
label.frame = CGRectMake(x, y, 8, 8);
|
|
18
18
|
[self addSubview:label];
|
|
19
19
|
//把小红点移到最顶层
|
|
20
20
|
[self bringSubviewToFront:label];
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
- (void)styleLabel:(UILabel *)label {
|
|
34
34
|
CGRect rect = label.bounds;
|
|
35
|
-
CGFloat radius =
|
|
35
|
+
CGFloat radius = 4;
|
|
36
36
|
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:rect
|
|
37
37
|
byRoundingCorners:UIRectCornerAllCorners
|
|
38
38
|
cornerRadii:CGSizeMake(radius, radius)];
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
@property(nonatomic, copy, readonly) NSString *moduleName;
|
|
8
8
|
@property(nonatomic, copy, readonly) NSDictionary *props;
|
|
9
9
|
@property(nonatomic, copy, readonly) NSDictionary *options;
|
|
10
|
+
@property(nonatomic, assign, readonly) BOOL animatedTransition;
|
|
10
11
|
|
|
11
12
|
- (instancetype)initWithModuleName:(NSString *)moduleName props:(NSDictionary *)props options:(NSDictionary *)options NS_DESIGNATED_INITIALIZER;
|
|
12
13
|
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
@property(nonatomic, copy, readwrite) NSDictionary *props;
|
|
14
14
|
@property(nonatomic, copy, readwrite) NSDictionary *options;
|
|
15
15
|
@property(nonatomic, assign) BOOL forceTransparentDialogWindow;
|
|
16
|
+
@property(nonatomic, assign) BOOL forceScreenLandscape;
|
|
17
|
+
@property(nonatomic, assign, readwrite) BOOL animatedTransition;
|
|
16
18
|
|
|
17
19
|
@end
|
|
18
20
|
|
|
@@ -35,8 +37,18 @@
|
|
|
35
37
|
_moduleName = moduleName;
|
|
36
38
|
_options = options;
|
|
37
39
|
_props = props;
|
|
40
|
+
_animatedTransition = YES;
|
|
41
|
+
|
|
42
|
+
if (options[@"animatedTransition"]) {
|
|
43
|
+
_animatedTransition = [options[@"animatedTransition"] boolValue];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (options[@"forceScreenLandscape"]) {
|
|
47
|
+
_forceScreenLandscape = [options[@"forceScreenLandscape"] boolValue];
|
|
48
|
+
}
|
|
38
49
|
|
|
39
50
|
self.forceTransparentDialogWindow = [options[@"forceTransparentDialogWindow"] boolValue];
|
|
51
|
+
|
|
40
52
|
[self applyNavigationBarOptions:options];
|
|
41
53
|
[self applyTabBarOptions:options];
|
|
42
54
|
}
|
|
@@ -96,6 +108,50 @@
|
|
|
96
108
|
}
|
|
97
109
|
}
|
|
98
110
|
|
|
111
|
+
- (void)willMoveToParentViewController:(UIViewController *)parent {
|
|
112
|
+
if (self.forceScreenLandscape) {
|
|
113
|
+
if (parent) {
|
|
114
|
+
[self setScreenOrientation:UIInterfaceOrientationLandscapeRight usingMask:UIInterfaceOrientationMaskLandscapeRight];
|
|
115
|
+
} else {
|
|
116
|
+
[self setScreenOrientation:UIInterfaceOrientationPortrait usingMask:UIInterfaceOrientationMaskPortrait];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
- (void)setScreenOrientation:(UIInterfaceOrientation) orientation usingMask:(UIInterfaceOrientationMask) mask {
|
|
122
|
+
[GlobalStyle globalStyle].interfaceOrientation = mask;
|
|
123
|
+
|
|
124
|
+
if (@available(iOS 16.0, *)) {
|
|
125
|
+
UIWindowScene *windowScene = [self getWindowScene];
|
|
126
|
+
if (windowScene != nil) {
|
|
127
|
+
UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:mask];
|
|
128
|
+
[windowScene requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) {
|
|
129
|
+
#if DEBUG
|
|
130
|
+
if (error) {
|
|
131
|
+
NSLog(@"Failed to update geometry with UIInterfaceOrientationMask: %@", error);
|
|
132
|
+
}
|
|
133
|
+
#endif
|
|
134
|
+
}];
|
|
135
|
+
}
|
|
136
|
+
} else {
|
|
137
|
+
UIDevice* currentDevice = [UIDevice currentDevice];
|
|
138
|
+
[currentDevice setValue:@(UIInterfaceOrientationUnknown) forKey:@"orientation"];
|
|
139
|
+
[currentDevice setValue:@(orientation) forKey:@"orientation"];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
[UIViewController attemptRotationToDeviceOrientation];
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
- (UIWindowScene *)getWindowScene API_AVAILABLE(ios(13.0)){
|
|
146
|
+
NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
|
|
147
|
+
for (id connectedScene in array) {
|
|
148
|
+
if ([connectedScene isKindOfClass:[UIWindowScene class]]) {
|
|
149
|
+
return connectedScene;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return nil;
|
|
153
|
+
}
|
|
154
|
+
|
|
99
155
|
- (void)statusBarFrameWillChange:(NSNotification *)notification {
|
|
100
156
|
[self setNeedsStatusBarAppearanceUpdate];
|
|
101
157
|
}
|
package/lib/Options.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export interface NavigationOption {
|
|
|
44
44
|
export interface NavigationItem extends NavigationOption {
|
|
45
45
|
passThroughTouches?: boolean;
|
|
46
46
|
forceTransparentDialogWindow?: boolean;
|
|
47
|
+
animatedTransition?: boolean;
|
|
48
|
+
forceScreenLandscape?: boolean;
|
|
47
49
|
topBarHidden?: boolean;
|
|
48
50
|
extendedLayoutIncludesTopBar?: boolean;
|
|
49
51
|
swipeBackEnabled?: boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hybrid-navigation",
|
|
3
3
|
"description": "React Native Navigation that supports seamless navigation between Native and React.",
|
|
4
|
-
"version": "2.17.
|
|
4
|
+
"version": "2.17.6",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|
package/src/Options.ts
CHANGED
|
@@ -45,6 +45,8 @@ export interface NavigationOption {
|
|
|
45
45
|
export interface NavigationItem extends NavigationOption {
|
|
46
46
|
passThroughTouches?: boolean // 触摸事件是否可以穿透到下一层页面,很少用。
|
|
47
47
|
forceTransparentDialogWindow?: boolean // 当页面是 Dialog 时,是否强制背景透明
|
|
48
|
+
animatedTransition?: boolean
|
|
49
|
+
forceScreenLandscape?: boolean // 是否强制横屏
|
|
48
50
|
topBarHidden?: boolean // 是否隐藏 TopBar
|
|
49
51
|
extendedLayoutIncludesTopBar?: boolean // 页面内容是否延伸到 TopBar 底下,通常用于需要动态改变 `topBarAlpha` 的场合
|
|
50
52
|
swipeBackEnabled?: boolean // 是否可以通过右滑返回。如果 `backInteractive` 设置为 false, 那么该值无效。Android 下,只有开启了侧滑返回功能,该值才会生效。
|