hybrid-navigation 5.3.0 → 5.5.0
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/HybridNavigation.podspec +1 -0
- package/android/proguard-rules.pro +5 -0
- package/android/src/main/java/com/navigation/androidx/AppUtils.java +8 -1
- package/android/src/main/java/com/navigation/androidx/AwesomeActivity.java +115 -36
- package/android/src/main/java/com/navigation/androidx/AwesomeFragment.java +153 -100
- package/android/src/main/java/com/navigation/androidx/DefaultTabBarProvider.java +1 -1
- package/android/src/main/java/com/navigation/androidx/DrawableUtils.java +5 -1
- package/android/src/main/java/com/navigation/androidx/DrawerFragment.java +95 -39
- package/android/src/main/java/com/navigation/androidx/FragmentHelper.java +195 -29
- package/android/src/main/java/com/navigation/androidx/HybridDrawerLayout.java +225 -27
- package/android/src/main/java/com/navigation/androidx/LifecycleDelegate.java +33 -9
- package/android/src/main/java/com/navigation/androidx/PresentationDelegate.java +5 -107
- package/android/src/main/java/com/navigation/androidx/StackDelegate.java +37 -10
- package/android/src/main/java/com/navigation/androidx/StackFragment.java +82 -19
- package/android/src/main/java/com/navigation/androidx/Style.java +8 -4
- package/android/src/main/java/com/navigation/androidx/SystemUI.java +17 -5
- package/android/src/main/java/com/navigation/androidx/TabBar.java +69 -29
- package/android/src/main/java/com/navigation/androidx/TabBarFragment.java +48 -11
- package/android/src/main/java/com/navigation/androidx/TabBarItem.java +1 -2
- package/android/src/main/java/com/navigation/androidx/TabView.java +20 -10
- package/android/src/main/java/com/reactnative/hybridnavigation/Constants.java +1 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +19 -15
- package/android/src/main/java/com/reactnative/hybridnavigation/GlobalStyle.java +10 -48
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDRootView.java +22 -23
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +54 -22
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeEvent.java +4 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeNavigation.java +35 -64
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationCommandQueue.java +185 -121
- package/android/src/main/java/com/reactnative/hybridnavigation/Navigator.java +21 -5
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigatorRegistry.java +27 -30
- package/android/src/main/java/com/reactnative/hybridnavigation/OrientationCoordinator.java +41 -4
- package/android/src/main/java/com/reactnative/hybridnavigation/Parameters.java +55 -154
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivity.java +30 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivityDelegate.java +12 -37
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +31 -181
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactManager.java +115 -71
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactStackFragment.java +27 -16
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactSurfaceCleanup.java +50 -8
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarFragment.java +34 -4
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarProvider.java +39 -10
- package/android/src/main/java/com/reactnative/hybridnavigation/RemovalPlan.java +76 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/SceneLifecycleStateMachine.java +72 -6
- package/android/src/main/java/com/reactnative/hybridnavigation/Utils.java +19 -3
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/DrawerNavigator.java +11 -5
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +217 -99
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +122 -59
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +87 -24
- package/dist/DeepLink.d.ts +3 -1
- package/dist/DeepLink.js +39 -19
- package/dist/NativeNavigation.d.ts +8 -5
- package/dist/Navigation.d.ts +9 -24
- package/dist/Navigation.js +32 -97
- package/dist/NavigationComponentWrap.d.ts +1 -2
- package/dist/NavigationComponentWrap.js +0 -15
- package/dist/Navigator.d.ts +7 -5
- package/dist/Navigator.js +38 -33
- package/dist/Options.d.ts +1 -6
- package/dist/Options.js +1 -2
- package/dist/Route.d.ts +24 -12
- package/dist/handler/DispatchCommandHandler.d.ts +4 -5
- package/dist/handler/DispatchCommandHandler.js +37 -16
- package/dist/handler/LayoutCommandHandler.js +18 -3
- package/dist/handler/LeaveGuardHandler.d.ts +12 -8
- package/dist/handler/LeaveGuardHandler.js +174 -281
- package/dist/handler/LifecycleEventHandler.d.ts +7 -4
- package/dist/handler/LifecycleEventHandler.js +119 -32
- package/dist/handler/ResultEventHandler.d.ts +2 -2
- package/dist/handler/ResultEventHandler.js +72 -36
- package/dist/handler/SceneExitHandler.d.ts +6 -0
- package/dist/handler/SceneExitHandler.js +48 -8
- package/dist/hooks.d.ts +1 -0
- package/dist/hooks.js +39 -23
- package/dist/index.d.ts +9 -8
- package/dist/index.js +5 -8
- package/dist/routeGraph.d.ts +5 -0
- package/dist/routeGraph.js +47 -0
- package/dist/router/drawer.d.ts +2 -2
- package/dist/router/drawer.js +19 -9
- package/dist/router/helpers.d.ts +17 -0
- package/dist/router/helpers.js +90 -0
- package/dist/router/index.d.ts +2 -2
- package/dist/router/index.js +169 -97
- package/dist/router/screen.d.ts +2 -2
- package/dist/router/screen.js +16 -7
- package/dist/router/stack.d.ts +2 -2
- package/dist/router/stack.js +24 -49
- package/dist/router/tabs.js +5 -1
- package/dist/store.d.ts +2 -0
- package/dist/store.js +4 -0
- package/ios/HBDGlobalStyle.h +0 -1
- package/ios/HBDGlobalStyle.mm +27 -39
- package/ios/HBDUtils.h +0 -2
- package/ios/HBDUtils.mm +81 -41
- package/ios/Navigator/HBDDrawerNavigator.mm +31 -26
- package/ios/Navigator/HBDNavigatorRegistry.mm +23 -26
- package/ios/Navigator/HBDScreenNavigator.mm +240 -137
- package/ios/Navigator/HBDStackNavigator.mm +147 -97
- package/ios/Navigator/HBDTabNavigator.mm +99 -46
- package/ios/React/HBDNativeEvent.mm +38 -5
- package/ios/React/HBDNativeNavigation.mm +49 -51
- package/ios/React/HBDNavigationCommandQueue.h +55 -0
- package/ios/React/HBDNavigationCommandQueue.mm +341 -0
- package/ios/React/HBDNavigator.h +20 -0
- package/ios/React/HBDOrientationCoordinator.mm +26 -3
- package/ios/React/HBDReactBridgeManager.h +18 -6
- package/ios/React/HBDReactBridgeManager.mm +536 -315
- package/ios/React/HBDSceneLifecycleStateMachine.h +2 -0
- package/ios/React/HBDSceneLifecycleStateMachine.mm +18 -0
- package/ios/View/HBDRootView.h +1 -0
- package/ios/View/HBDRootView.mm +112 -4
- package/ios/View/UIImage+WithBadge.mm +9 -7
- package/ios/ViewController/HBDDrawerController.h +10 -0
- package/ios/ViewController/HBDDrawerController.mm +103 -71
- package/ios/ViewController/HBDNavigationController.mm +166 -58
- package/ios/ViewController/HBDReactViewController.h +0 -2
- package/ios/ViewController/HBDReactViewController.mm +13 -102
- package/ios/ViewController/HBDTabBarController.mm +67 -33
- package/ios/ViewController/HBDViewController.h +6 -0
- package/ios/ViewController/HBDViewController.mm +94 -37
- package/ios/ViewController/UINavigationController+HBD.h +2 -2
- package/ios/ViewController/UINavigationController+HBD.mm +13 -13
- package/ios/ViewController/UIViewController+HBD.h +23 -1
- package/ios/ViewController/UIViewController+HBD.mm +298 -40
- package/package.json +1 -1
- package/src/DeepLink.ts +39 -19
- package/src/NativeNavigation.ts +17 -5
- package/src/Navigation.ts +49 -170
- package/src/NavigationComponentWrap.tsx +1 -16
- package/src/Navigator.ts +50 -52
- package/src/Options.ts +4 -9
- package/src/Route.ts +37 -19
- package/src/handler/DispatchCommandHandler.ts +42 -20
- package/src/handler/LayoutCommandHandler.ts +15 -3
- package/src/handler/LeaveGuardHandler.ts +224 -329
- package/src/handler/LifecycleEventHandler.ts +131 -37
- package/src/handler/ResultEventHandler.ts +71 -37
- package/src/handler/SceneExitHandler.ts +60 -9
- package/src/hooks.ts +54 -26
- package/src/index.ts +77 -8
- package/src/routeGraph.ts +50 -0
- package/src/router/drawer.ts +21 -10
- package/src/router/helpers.ts +113 -0
- package/src/router/index.ts +187 -112
- package/src/router/screen.ts +35 -8
- package/src/router/stack.ts +40 -53
- package/src/router/tabs.ts +5 -1
- package/src/store.ts +5 -0
- package/dist/sceneCoverage.d.ts +0 -2
- package/dist/sceneCoverage.js +0 -25
- package/src/sceneCoverage.ts +0 -30
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
package com.reactnative.hybridnavigation;
|
|
2
2
|
|
|
3
|
-
import android.content.Context;
|
|
4
3
|
import android.graphics.Rect;
|
|
5
4
|
import android.os.Bundle;
|
|
6
|
-
import android.os.Handler;
|
|
7
|
-
import android.os.Looper;
|
|
8
|
-
import android.os.SystemClock;
|
|
9
|
-
import android.view.Choreographer;
|
|
10
5
|
import android.view.LayoutInflater;
|
|
11
6
|
import android.view.View;
|
|
12
7
|
import android.view.ViewGroup;
|
|
@@ -22,35 +17,20 @@ import androidx.fragment.app.FragmentActivity;
|
|
|
22
17
|
import com.facebook.common.logging.FLog;
|
|
23
18
|
import com.facebook.react.ReactHost;
|
|
24
19
|
import com.facebook.react.bridge.Arguments;
|
|
25
|
-
import com.facebook.react.interfaces.TaskInterface;
|
|
26
20
|
import com.facebook.react.interfaces.fabric.ReactSurface;
|
|
27
21
|
import com.facebook.react.uimanager.PixelUtil;
|
|
28
22
|
import com.navigation.androidx.AwesomeFragment;
|
|
29
23
|
import com.navigation.androidx.DrawerFragment;
|
|
30
|
-
import com.navigation.androidx.StackFragment;
|
|
31
24
|
import com.navigation.androidx.SystemUI;
|
|
32
25
|
|
|
33
26
|
public class ReactFragment extends HybridFragment implements ReactManager.ReactBridgeReloadListener {
|
|
34
27
|
|
|
35
28
|
protected static final String TAG = "Navigation";
|
|
36
|
-
private static final long DEFAULT_PUSH_PREWARM_TIMEOUT_MS = 250L;
|
|
37
|
-
|
|
38
|
-
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
|
39
29
|
|
|
40
30
|
private HBDRootView reactRootView;
|
|
41
31
|
|
|
42
32
|
private ReactSurface reactSurface;
|
|
43
33
|
|
|
44
|
-
@Nullable
|
|
45
|
-
private TaskInterface<Void> prewarmedStartTask;
|
|
46
|
-
private boolean surfacePrewarmed = false;
|
|
47
|
-
@Nullable
|
|
48
|
-
private Runnable pushPrewarmOnReady;
|
|
49
|
-
@Nullable
|
|
50
|
-
private Runnable pushPrewarmTimeoutRunnable;
|
|
51
|
-
private int pushPrewarmGeneration = 0;
|
|
52
|
-
private long pushPrewarmStartUptimeMs = 0L;
|
|
53
|
-
|
|
54
34
|
@Nullable
|
|
55
35
|
private ReactManager.ReactModuleRegisterListener pendingRegisterListener;
|
|
56
36
|
|
|
@@ -59,131 +39,6 @@ public class ReactFragment extends HybridFragment implements ReactManager.ReactB
|
|
|
59
39
|
return false;
|
|
60
40
|
}
|
|
61
41
|
|
|
62
|
-
public boolean prepareForAnimatedPush(
|
|
63
|
-
@NonNull StackFragment stackFragment,
|
|
64
|
-
@NonNull View container,
|
|
65
|
-
long timeoutMs,
|
|
66
|
-
@NonNull Runnable onReady
|
|
67
|
-
) {
|
|
68
|
-
if (!getReactManager().getGlobalStyle().isPrewarmPush()
|
|
69
|
-
|| !isReactModuleRegisterCompleted()
|
|
70
|
-
|| !shouldAnimatedTransition()
|
|
71
|
-
|| reactSurface != null) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
FragmentActivity activity = stackFragment.getActivity();
|
|
75
|
-
if (activity == null || activity.isFinishing() || activity.isDestroyed()) {
|
|
76
|
-
return false;
|
|
77
|
-
}
|
|
78
|
-
int width = container.getWidth();
|
|
79
|
-
int height = container.getHeight();
|
|
80
|
-
if (width <= 0 || height <= 0) {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
Window window = activity.getWindow();
|
|
84
|
-
if (window == null) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
View contentView = window.getDecorView().findViewById(android.R.id.content);
|
|
88
|
-
if (contentView == null || contentView.getWidth() != width || contentView.getHeight() != height) {
|
|
89
|
-
return false;
|
|
90
|
-
}
|
|
91
|
-
if (stackFragment.getTabBarFragment() != null || isFragmentInsideDrawerMenu(stackFragment)) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
if (stackFragment.getPresentingFragment() != null) {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
if (!canUseCurrentWindowGeometry(window, width, height)) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
ReactHost reactHost = getReactManager().getReactHost();
|
|
102
|
-
ReactSurface surface = reactHost.createSurface(activity, getModuleName(), buildInitialProps(activity, stackFragment, container));
|
|
103
|
-
View surfaceView = surface.getView();
|
|
104
|
-
if (surfaceView == null) {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// 离屏先按真实容器尺寸测量,让 Fabric 立即使用精确约束执行首帧渲染与挂载,避免右滑前半段空白。
|
|
109
|
-
int widthSpec = View.MeasureSpec.makeMeasureSpec(width, View.MeasureSpec.EXACTLY);
|
|
110
|
-
int heightSpec = View.MeasureSpec.makeMeasureSpec(height, View.MeasureSpec.EXACTLY);
|
|
111
|
-
surfaceView.measure(widthSpec, heightSpec);
|
|
112
|
-
surfaceView.layout(0, 0, width, height);
|
|
113
|
-
|
|
114
|
-
pushPrewarmGeneration += 1;
|
|
115
|
-
int generation = pushPrewarmGeneration;
|
|
116
|
-
pushPrewarmOnReady = onReady;
|
|
117
|
-
pushPrewarmStartUptimeMs = SystemClock.uptimeMillis();
|
|
118
|
-
reactSurface = surface;
|
|
119
|
-
surfacePrewarmed = true;
|
|
120
|
-
|
|
121
|
-
getReactManager().registerPrewarmingFragment(this);
|
|
122
|
-
getReactManager().addReactBridgeReloadListener(this);
|
|
123
|
-
getLifecycleStateMachine().onMount();
|
|
124
|
-
prewarmedStartTask = surface.start();
|
|
125
|
-
|
|
126
|
-
long safeTimeout = timeoutMs > 0 ? timeoutMs : DEFAULT_PUSH_PREWARM_TIMEOUT_MS;
|
|
127
|
-
Runnable timeoutTask = () -> finishPushPrewarmWait(generation, "timeout");
|
|
128
|
-
pushPrewarmTimeoutRunnable = timeoutTask;
|
|
129
|
-
mainHandler.postDelayed(timeoutTask, safeTimeout);
|
|
130
|
-
return true;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
public void cancelPushPrewarm(boolean stopUnattachedSurface) {
|
|
134
|
-
pushPrewarmGeneration += 1;
|
|
135
|
-
pushPrewarmOnReady = null;
|
|
136
|
-
if (pushPrewarmTimeoutRunnable != null) {
|
|
137
|
-
mainHandler.removeCallbacks(pushPrewarmTimeoutRunnable);
|
|
138
|
-
pushPrewarmTimeoutRunnable = null;
|
|
139
|
-
}
|
|
140
|
-
getReactManager().unregisterPrewarmingFragment(this);
|
|
141
|
-
if (stopUnattachedSurface && surfacePrewarmed && reactRootView == null) {
|
|
142
|
-
surfacePrewarmed = false;
|
|
143
|
-
ReactSurface oldSurface = reactSurface;
|
|
144
|
-
TaskInterface<Void> oldStartTask = prewarmedStartTask;
|
|
145
|
-
reactSurface = null;
|
|
146
|
-
prewarmedStartTask = null;
|
|
147
|
-
getReactManager().removeReactBridgeReloadListener(this);
|
|
148
|
-
getLifecycleStateMachine().onUnmount();
|
|
149
|
-
if (!isAdded()) {
|
|
150
|
-
// 预热期间已提前 onMount;未 attach 即取消时 Fragment 不会走 onDestroy,补发 destroyed 闭合生命周期。
|
|
151
|
-
getLifecycleStateMachine().onDestroy();
|
|
152
|
-
}
|
|
153
|
-
if (oldSurface != null) {
|
|
154
|
-
ReactSurfaceCleanup.stopThenRun(oldSurface, oldStartTask, null);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
private void finishPushPrewarmWait(int generation, @NonNull String reason) {
|
|
160
|
-
if (generation != pushPrewarmGeneration) {
|
|
161
|
-
return;
|
|
162
|
-
}
|
|
163
|
-
Runnable onReady = pushPrewarmOnReady;
|
|
164
|
-
if (onReady == null) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
pushPrewarmGeneration += 1;
|
|
168
|
-
pushPrewarmOnReady = null;
|
|
169
|
-
if (pushPrewarmTimeoutRunnable != null) {
|
|
170
|
-
mainHandler.removeCallbacks(pushPrewarmTimeoutRunnable);
|
|
171
|
-
pushPrewarmTimeoutRunnable = null;
|
|
172
|
-
}
|
|
173
|
-
long elapsedMs = SystemClock.uptimeMillis() - pushPrewarmStartUptimeMs;
|
|
174
|
-
FLog.i(TAG, "ReactFragment#pushPrewarm ready module=" + getModuleName() + " reason=" + reason + " elapsedMs=" + elapsedMs);
|
|
175
|
-
onReady.run();
|
|
176
|
-
if (isAdded()) {
|
|
177
|
-
getReactManager().unregisterPrewarmingFragment(this);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
@Override
|
|
182
|
-
public void onAttach(@NonNull Context context) {
|
|
183
|
-
super.onAttach(context);
|
|
184
|
-
getReactManager().unregisterPrewarmingFragment(this);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
42
|
@Nullable
|
|
188
43
|
@Override
|
|
189
44
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
@@ -224,19 +79,12 @@ public class ReactFragment extends HybridFragment implements ReactManager.ReactB
|
|
|
224
79
|
|
|
225
80
|
@Override
|
|
226
81
|
public void onDestroyView() {
|
|
227
|
-
cancelPushPrewarm(false);
|
|
228
82
|
super.onDestroyView();
|
|
229
83
|
clearPendingRegisterListener();
|
|
230
84
|
unmountReactView();
|
|
231
85
|
reactRootView = null;
|
|
232
86
|
}
|
|
233
87
|
|
|
234
|
-
@Override
|
|
235
|
-
public void onDestroy() {
|
|
236
|
-
cancelPushPrewarm(true);
|
|
237
|
-
super.onDestroy();
|
|
238
|
-
}
|
|
239
|
-
|
|
240
88
|
@Override
|
|
241
89
|
public void onResume() {
|
|
242
90
|
super.onResume();
|
|
@@ -246,6 +94,23 @@ public class ReactFragment extends HybridFragment implements ReactManager.ReactB
|
|
|
246
94
|
getLifecycleStateMachine().onHostResume(canEmitReactVisibility());
|
|
247
95
|
}
|
|
248
96
|
|
|
97
|
+
@Override
|
|
98
|
+
void syncPausedVisibilityOnReactContextResumed() {
|
|
99
|
+
if ((isResumed() && !isResumingForRedirect())
|
|
100
|
+
|| (!getLifecycleStateMachine().isVisible() && !getLifecycleStateMachine().isVisibleScheduled())) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
getLifecycleStateMachine().onHostPause(canEmitReactVisibility());
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@Override
|
|
107
|
+
void syncVisibilityOnReactContextResumed() {
|
|
108
|
+
if (!isResumed() || isResumingForRedirect()) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
getLifecycleStateMachine().onHostResume(canEmitReactVisibility());
|
|
112
|
+
}
|
|
113
|
+
|
|
249
114
|
@Override
|
|
250
115
|
public void onPause() {
|
|
251
116
|
super.onPause();
|
|
@@ -256,26 +121,30 @@ public class ReactFragment extends HybridFragment implements ReactManager.ReactB
|
|
|
256
121
|
return reactSurface != null && isReactModuleRegisterCompleted() && isReactContextResumed();
|
|
257
122
|
}
|
|
258
123
|
|
|
124
|
+
@Override
|
|
125
|
+
protected boolean isReadyForVisible() {
|
|
126
|
+
return isAdded() && isResumed() && !isResumingForRedirect() && canEmitReactVisibility();
|
|
127
|
+
}
|
|
128
|
+
|
|
259
129
|
@Override
|
|
260
130
|
public void onReload() {
|
|
261
|
-
cancelPushPrewarm(true);
|
|
262
131
|
getLifecycleStateMachine().onReload();
|
|
263
|
-
unmountReactView();
|
|
132
|
+
unmountReactView(true);
|
|
264
133
|
}
|
|
265
134
|
|
|
266
135
|
private void mountReactView(@Nullable ViewGroup container) {
|
|
267
|
-
|
|
136
|
+
initReactRootView(container);
|
|
268
137
|
getReactManager().addReactBridgeReloadListener(this);
|
|
269
|
-
|
|
270
|
-
getLifecycleStateMachine().onMount();
|
|
271
|
-
}
|
|
138
|
+
getLifecycleStateMachine().onMount();
|
|
272
139
|
}
|
|
273
140
|
|
|
274
141
|
private void unmountReactView() {
|
|
142
|
+
unmountReactView(false);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
private void unmountReactView(boolean detachImmediately) {
|
|
275
146
|
getReactManager().removeReactBridgeReloadListener(this);
|
|
276
147
|
getLifecycleStateMachine().onUnmount();
|
|
277
|
-
surfacePrewarmed = false;
|
|
278
|
-
prewarmedStartTask = null;
|
|
279
148
|
|
|
280
149
|
if (reactSurface != null) {
|
|
281
150
|
FLog.w(TAG, "销毁页面-:" + getModuleName());
|
|
@@ -283,24 +152,13 @@ public class ReactFragment extends HybridFragment implements ReactManager.ReactB
|
|
|
283
152
|
}
|
|
284
153
|
|
|
285
154
|
if (reactRootView != null) {
|
|
286
|
-
reactRootView.clearSurface(true);
|
|
155
|
+
reactRootView.clearSurface(true, detachImmediately);
|
|
287
156
|
}
|
|
288
|
-
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
@Override
|
|
292
|
-
protected boolean onBackPressed() {
|
|
293
|
-
return super.onBackPressed();
|
|
294
157
|
}
|
|
295
158
|
|
|
296
159
|
public void signalFirstRenderComplete() {
|
|
297
160
|
boolean canEmit = canEmitReactVisibility() && isResumed() && !isResumingForRedirect();
|
|
298
161
|
getLifecycleStateMachine().onFirstRenderComplete(canEmit);
|
|
299
|
-
if (pushPrewarmOnReady != null) {
|
|
300
|
-
int generation = pushPrewarmGeneration;
|
|
301
|
-
// 等一帧 Choreographer,让 Fabric MountingManager 将当前提交的挂载项同步执行进 ReactSurfaceView。
|
|
302
|
-
Choreographer.getInstance().postFrameCallback(frameTimeNanos -> finishPushPrewarmWait(generation, "firstRender"));
|
|
303
|
-
}
|
|
304
162
|
}
|
|
305
163
|
|
|
306
164
|
public boolean isFirstRenderCompleted() {
|
|
@@ -321,18 +179,11 @@ public class ReactFragment extends HybridFragment implements ReactManager.ReactB
|
|
|
321
179
|
}
|
|
322
180
|
}
|
|
323
181
|
|
|
324
|
-
private
|
|
182
|
+
private void initReactRootView(@Nullable ViewGroup container) {
|
|
325
183
|
HBDRootView rootView = reactRootView;
|
|
326
184
|
if (rootView == null) {
|
|
327
185
|
throw new IllegalStateException("[Navigation] HBDRootView 还没有创建。");
|
|
328
186
|
}
|
|
329
|
-
if (surfacePrewarmed && reactSurface != null) {
|
|
330
|
-
surfacePrewarmed = false;
|
|
331
|
-
TaskInterface<Void> startTask = prewarmedStartTask;
|
|
332
|
-
prewarmedStartTask = null;
|
|
333
|
-
rootView.attachPrewarmedSurface(reactSurface, startTask);
|
|
334
|
-
return true;
|
|
335
|
-
}
|
|
336
187
|
ReactHost reactHost = getReactManager().getReactHost();
|
|
337
188
|
Bundle initialProps = buildInitialProps(requireActivity(), this, container);
|
|
338
189
|
ReactSurface reactSurface = reactHost.createSurface(requireContext(), getModuleName(), initialProps);
|
|
@@ -340,7 +191,6 @@ public class ReactFragment extends HybridFragment implements ReactManager.ReactB
|
|
|
340
191
|
|
|
341
192
|
rootView.setAppProperties(initialProps);
|
|
342
193
|
rootView.setSurface(reactSurface);
|
|
343
|
-
return false;
|
|
344
194
|
}
|
|
345
195
|
|
|
346
196
|
@NonNull
|
|
@@ -25,6 +25,8 @@ import java.util.HashMap;
|
|
|
25
25
|
import java.util.List;
|
|
26
26
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
27
27
|
|
|
28
|
+
import kotlin.Unit;
|
|
29
|
+
|
|
28
30
|
@UiThread
|
|
29
31
|
public class ReactManager {
|
|
30
32
|
|
|
@@ -49,7 +51,6 @@ public class ReactManager {
|
|
|
49
51
|
|
|
50
52
|
private final HashMap<String, Class<? extends HybridFragment>> nativeModules = new HashMap<>();
|
|
51
53
|
private final HashMap<String, ReadableMap> reactModules = new HashMap<>();
|
|
52
|
-
private final HashMap<String, WeakReference<ReactFragment>> prewarmingFragments = new HashMap<>();
|
|
53
54
|
private final CopyOnWriteArrayList<ReactModuleRegisterListener> reactModuleRegisterListeners = new CopyOnWriteArrayList<>();
|
|
54
55
|
private final CopyOnWriteArrayList<ReactBridgeReloadListener> reactBridgeReloadListeners = new CopyOnWriteArrayList<>();
|
|
55
56
|
private final NavigatorRegistry navigatorRegistry = new NavigatorRegistry();
|
|
@@ -65,6 +66,8 @@ public class ReactManager {
|
|
|
65
66
|
|
|
66
67
|
private boolean reactModuleRegisterCompleted = false;
|
|
67
68
|
private boolean initialized = false;
|
|
69
|
+
@Nullable
|
|
70
|
+
private WeakReference<NativeNavigation> activeNavigationModule;
|
|
68
71
|
|
|
69
72
|
public void install(@NonNull ReactHost reactNativeHost) {
|
|
70
73
|
this.setReactHost(reactNativeHost);
|
|
@@ -87,12 +90,16 @@ public class ReactManager {
|
|
|
87
90
|
return;
|
|
88
91
|
}
|
|
89
92
|
initialized = true;
|
|
93
|
+
reactHost.addBeforeDestroyListener(() -> {
|
|
94
|
+
FLog.i(TAG, "React instance is about to be destroyed.");
|
|
95
|
+
handleBeforeReactHostDestroy();
|
|
96
|
+
return Unit.INSTANCE;
|
|
97
|
+
});
|
|
90
98
|
reactHost.addReactInstanceEventListener(new ReactInstanceEventListener() {
|
|
91
99
|
@Override
|
|
92
100
|
public void onReactContextInitialized(@NonNull ReactContext reactContext) {
|
|
93
101
|
FLog.i(TAG, "React instance context initialized.");
|
|
94
|
-
|
|
95
|
-
resetStateForReactInit();
|
|
102
|
+
syncResumedVisibility();
|
|
96
103
|
}
|
|
97
104
|
});
|
|
98
105
|
reactHost.start();
|
|
@@ -106,7 +113,7 @@ public class ReactManager {
|
|
|
106
113
|
|
|
107
114
|
@Nullable
|
|
108
115
|
public ReactContext getCurrentReactContext() {
|
|
109
|
-
return reactHost.getCurrentReactContext();
|
|
116
|
+
return reactHost != null ? reactHost.getCurrentReactContext() : null;
|
|
110
117
|
}
|
|
111
118
|
|
|
112
119
|
@Nullable
|
|
@@ -127,6 +134,7 @@ public class ReactManager {
|
|
|
127
134
|
|
|
128
135
|
void onActivityResumed(@NonNull ReactAppCompatActivity activity) {
|
|
129
136
|
commandQueue.onActivityResumed(activity);
|
|
137
|
+
syncResumedVisibility();
|
|
130
138
|
}
|
|
131
139
|
|
|
132
140
|
@Nullable
|
|
@@ -142,44 +150,6 @@ public class ReactManager {
|
|
|
142
150
|
return commandQueue.getRootGeneration();
|
|
143
151
|
}
|
|
144
152
|
|
|
145
|
-
public int getCommandGeneration() {
|
|
146
|
-
return commandQueue.getCommandGeneration();
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
void registerPrewarmingFragment(@NonNull ReactFragment fragment) {
|
|
150
|
-
String sceneId = fragment.getSceneId();
|
|
151
|
-
if (sceneId != null && !sceneId.isEmpty()) {
|
|
152
|
-
prewarmingFragments.put(sceneId, new WeakReference<>(fragment));
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
void unregisterPrewarmingFragment(@NonNull ReactFragment fragment) {
|
|
157
|
-
String sceneId = fragment.getSceneId();
|
|
158
|
-
if (sceneId == null || sceneId.isEmpty()) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
WeakReference<ReactFragment> ref = prewarmingFragments.get(sceneId);
|
|
162
|
-
if (ref != null) {
|
|
163
|
-
ReactFragment existing = ref.get();
|
|
164
|
-
if (existing == null || existing == fragment) {
|
|
165
|
-
prewarmingFragments.remove(sceneId);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
@Nullable
|
|
171
|
-
ReactFragment findPrewarmingFragmentBySceneId(@NonNull String sceneId) {
|
|
172
|
-
WeakReference<ReactFragment> ref = prewarmingFragments.get(sceneId);
|
|
173
|
-
if (ref == null) {
|
|
174
|
-
return null;
|
|
175
|
-
}
|
|
176
|
-
ReactFragment fragment = ref.get();
|
|
177
|
-
if (fragment == null) {
|
|
178
|
-
prewarmingFragments.remove(sceneId);
|
|
179
|
-
}
|
|
180
|
-
return fragment;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
153
|
boolean hasQueuedSetRoot() {
|
|
184
154
|
return commandQueue.hasQueuedSetRoot();
|
|
185
155
|
}
|
|
@@ -188,8 +158,8 @@ public class ReactManager {
|
|
|
188
158
|
commandQueue.drain();
|
|
189
159
|
}
|
|
190
160
|
|
|
191
|
-
void installRootFragment(@NonNull ReactAppCompatActivity activity, @NonNull Runnable installAction) {
|
|
192
|
-
commandQueue.installRootFragment(activity, installAction);
|
|
161
|
+
void installRootFragment(@NonNull ReactAppCompatActivity activity, @NonNull AwesomeFragment fragment, @NonNull Runnable installAction) {
|
|
162
|
+
commandQueue.installRootFragment(activity, fragment, installAction);
|
|
193
163
|
}
|
|
194
164
|
|
|
195
165
|
@NonNull
|
|
@@ -202,14 +172,28 @@ public class ReactManager {
|
|
|
202
172
|
ReactAppCompatActivity activity = getActiveActivity();
|
|
203
173
|
if (activity != null) {
|
|
204
174
|
activity.inflateStyle();
|
|
175
|
+
applyGlobalStyleToHierarchy(activity.getSupportFragmentManager(), style);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
private void applyGlobalStyleToHierarchy(@NonNull FragmentManager fragmentManager, @NonNull GlobalStyle style) {
|
|
180
|
+
if (fragmentManager.isDestroyed()) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
for (AwesomeFragment fragment : FragmentHelper.getFragments(fragmentManager)) {
|
|
184
|
+
if (fragment instanceof ReactTabBarFragment tabBarFragment) {
|
|
185
|
+
tabBarFragment.applyGlobalStyle(style);
|
|
186
|
+
}
|
|
187
|
+
applyGlobalStyleToHierarchy(fragment.getChildFragmentManager(), style);
|
|
205
188
|
}
|
|
206
189
|
}
|
|
207
190
|
|
|
208
191
|
void recordRootLayout(@NonNull ReadableMap layout, boolean sticky) {
|
|
192
|
+
WritableMap copied = Arguments.fromBundle(Parameters.toBundle(layout));
|
|
209
193
|
if (sticky && stickyLayout == null) {
|
|
210
|
-
stickyLayout =
|
|
194
|
+
stickyLayout = copied;
|
|
211
195
|
}
|
|
212
|
-
rootLayout =
|
|
196
|
+
rootLayout = copied;
|
|
213
197
|
}
|
|
214
198
|
|
|
215
199
|
@Nullable
|
|
@@ -245,11 +229,7 @@ public class ReactManager {
|
|
|
245
229
|
if (activity == null || !commandQueue.isViewHierarchyReady()) {
|
|
246
230
|
return null;
|
|
247
231
|
}
|
|
248
|
-
|
|
249
|
-
if (fragment != null) {
|
|
250
|
-
return fragment;
|
|
251
|
-
}
|
|
252
|
-
return findPrewarmingFragmentBySceneId(sceneId);
|
|
232
|
+
return FragmentHelper.findAwesomeFragment(activity.getSupportFragmentManager(), sceneId);
|
|
253
233
|
}
|
|
254
234
|
|
|
255
235
|
@Nullable
|
|
@@ -331,6 +311,7 @@ public class ReactManager {
|
|
|
331
311
|
for (ReactModuleRegisterListener listener : reactModuleRegisterListeners) {
|
|
332
312
|
listener.onReactModuleRegisterCompleted();
|
|
333
313
|
}
|
|
314
|
+
syncResumedVisibility();
|
|
334
315
|
}
|
|
335
316
|
|
|
336
317
|
public void addReactModuleRegisterListener(@NonNull ReactModuleRegisterListener listener) {
|
|
@@ -349,18 +330,68 @@ public class ReactManager {
|
|
|
349
330
|
reactBridgeReloadListeners.remove(listener);
|
|
350
331
|
}
|
|
351
332
|
|
|
333
|
+
void bindNavigationModule(@NonNull NativeNavigation module) {
|
|
334
|
+
activeNavigationModule = new WeakReference<>(module);
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
boolean invalidateForModule(@NonNull NativeNavigation module) {
|
|
338
|
+
NativeNavigation current = activeNavigationModule != null ? activeNavigationModule.get() : null;
|
|
339
|
+
if (current != module) {
|
|
340
|
+
return false;
|
|
341
|
+
}
|
|
342
|
+
activeNavigationModule = null;
|
|
343
|
+
invalidate();
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
|
|
352
347
|
public void invalidate() {
|
|
353
|
-
prewarmingFragments.clear();
|
|
354
348
|
invokeReloadListeners();
|
|
355
349
|
setReactModuleRegisterCompleted(false);
|
|
350
|
+
rootLayout = null;
|
|
351
|
+
stickyLayout = null;
|
|
356
352
|
commandQueue.invalidate("Navigation host was invalidated.");
|
|
353
|
+
for (Navigator navigator : navigatorRegistry.allNavigators()) {
|
|
354
|
+
navigator.invalidate();
|
|
355
|
+
}
|
|
357
356
|
}
|
|
358
357
|
|
|
359
|
-
private void
|
|
360
|
-
|
|
358
|
+
private void handleBeforeReactHostDestroy() {
|
|
359
|
+
ReactAppCompatActivity activity = getActiveActivity();
|
|
360
|
+
activeNavigationModule = null;
|
|
361
|
+
invalidate();
|
|
362
|
+
reactBridgeReloadListeners.clear();
|
|
361
363
|
rootLayout = null;
|
|
362
364
|
stickyLayout = null;
|
|
363
|
-
|
|
365
|
+
if (activity != null && !activity.isFinishingOrDestroyed()) {
|
|
366
|
+
activity.clearFragments();
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
private void syncResumedVisibility() {
|
|
371
|
+
ReactAppCompatActivity activity = getActiveActivity();
|
|
372
|
+
if (activity == null) {
|
|
373
|
+
return;
|
|
374
|
+
}
|
|
375
|
+
FragmentManager fragmentManager = activity.getSupportFragmentManager();
|
|
376
|
+
syncResumedVisibility(fragmentManager, true);
|
|
377
|
+
syncResumedVisibility(fragmentManager, false);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
private void syncResumedVisibility(@NonNull FragmentManager fragmentManager, boolean pauseOnly) {
|
|
381
|
+
if (fragmentManager.isDestroyed()) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
List<AwesomeFragment> fragments = FragmentHelper.getFragments(fragmentManager);
|
|
385
|
+
for (AwesomeFragment fragment : fragments) {
|
|
386
|
+
if (fragment instanceof HybridFragment hybridFragment) {
|
|
387
|
+
if (pauseOnly) {
|
|
388
|
+
hybridFragment.syncPausedVisibilityOnReactContextResumed();
|
|
389
|
+
} else {
|
|
390
|
+
hybridFragment.syncVisibilityOnReactContextResumed();
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
syncResumedVisibility(fragment.getChildFragmentManager(), pauseOnly);
|
|
394
|
+
}
|
|
364
395
|
}
|
|
365
396
|
|
|
366
397
|
private void invokeReloadListeners() {
|
|
@@ -402,11 +433,13 @@ public class ReactManager {
|
|
|
402
433
|
|
|
403
434
|
@Nullable
|
|
404
435
|
public HybridFragment primaryFragment(@NonNull FragmentManager fragmentManager) {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
436
|
+
List<AwesomeFragment> fragments = FragmentHelper.getFragments(fragmentManager);
|
|
437
|
+
for (int i = fragments.size() - 1; i >= 0; i--) {
|
|
438
|
+
HybridFragment primary = primaryFragment(fragments.get(i));
|
|
439
|
+
if (primary != null) {
|
|
440
|
+
return primary;
|
|
441
|
+
}
|
|
408
442
|
}
|
|
409
|
-
|
|
410
443
|
return null;
|
|
411
444
|
}
|
|
412
445
|
|
|
@@ -416,13 +449,6 @@ public class ReactManager {
|
|
|
416
449
|
return null;
|
|
417
450
|
}
|
|
418
451
|
|
|
419
|
-
if (fragment.definesPresentationContext()) {
|
|
420
|
-
AwesomeFragment presented = fragment.getPresentedFragment();
|
|
421
|
-
if (presented != null) {
|
|
422
|
-
return primaryFragment(presented);
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
452
|
String layout = navigatorRegistry.layoutForFragment(fragment);
|
|
427
453
|
if (layout == null) {
|
|
428
454
|
return null;
|
|
@@ -450,6 +476,24 @@ public class ReactManager {
|
|
|
450
476
|
}
|
|
451
477
|
}
|
|
452
478
|
|
|
479
|
+
@NonNull
|
|
480
|
+
public RemovalPlan planRemoval(
|
|
481
|
+
@NonNull FragmentManager fragmentManager,
|
|
482
|
+
@NonNull String sceneId,
|
|
483
|
+
@NonNull String action,
|
|
484
|
+
@NonNull ReadableMap extras
|
|
485
|
+
) {
|
|
486
|
+
AwesomeFragment target = FragmentHelper.findAwesomeFragment(fragmentManager, sceneId);
|
|
487
|
+
if (target == null || !target.isAdded() || FragmentHelper.isRemoving(target)) {
|
|
488
|
+
return RemovalPlan.fail(DispatchResult.CODE_SCENE_NOT_FOUND);
|
|
489
|
+
}
|
|
490
|
+
Navigator navigator = navigatorRegistry.navigatorForAction(action);
|
|
491
|
+
if (navigator == null) {
|
|
492
|
+
return RemovalPlan.fail(DispatchResult.CODE_INVALID_ACTION);
|
|
493
|
+
}
|
|
494
|
+
return navigator.planRemoval(target, action, extras);
|
|
495
|
+
}
|
|
496
|
+
|
|
453
497
|
// ---- Fragment factory ----
|
|
454
498
|
|
|
455
499
|
@Nullable
|
|
@@ -519,10 +563,10 @@ public class ReactManager {
|
|
|
519
563
|
}
|
|
520
564
|
|
|
521
565
|
ReadableMap readableMap = reactModuleOptionsForKey(moduleName);
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
return
|
|
566
|
+
if (readableMap == null) {
|
|
567
|
+
return options;
|
|
568
|
+
}
|
|
569
|
+
return Parameters.mergeOptions(Parameters.toBundle(readableMap), options);
|
|
526
570
|
}
|
|
527
571
|
|
|
528
572
|
@NonNull
|
|
@@ -539,7 +583,7 @@ public class ReactManager {
|
|
|
539
583
|
try {
|
|
540
584
|
return fragmentClass.getDeclaredConstructor().newInstance();
|
|
541
585
|
} catch (Exception e) {
|
|
542
|
-
throw new IllegalArgumentException("无法创建名为 " + moduleName + " 的模块。");
|
|
586
|
+
throw new IllegalArgumentException("无法创建名为 " + moduleName + " 的模块。", e);
|
|
543
587
|
}
|
|
544
588
|
}
|
|
545
589
|
|
|
@@ -31,35 +31,46 @@ public class ReactStackFragment extends StackFragment {
|
|
|
31
31
|
|
|
32
32
|
@Override
|
|
33
33
|
protected void pushFragmentSync(AwesomeFragment fragment, @NonNull Runnable completion, @NonNull TransitionAnimation animation) {
|
|
34
|
-
if (fragment instanceof HybridFragment hybridFragment) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
34
|
+
if (fragment instanceof HybridFragment hybridFragment && !hybridFragment.shouldAnimatedTransition()) {
|
|
35
|
+
super.pushFragmentSync(fragment, completion, TransitionAnimation.None);
|
|
36
|
+
return;
|
|
39
37
|
}
|
|
40
38
|
super.pushFragmentSync(fragment, completion, animation);
|
|
41
39
|
}
|
|
42
40
|
|
|
43
41
|
@Override
|
|
44
42
|
protected void popToFragmentSync(AwesomeFragment fragment, @NonNull Runnable completion, @NonNull TransitionAnimation animation) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
super.popToFragmentSync(fragment, completion, TransitionAnimation.None);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
43
|
+
if (shouldDisablePopAnimation(getTopFragment(), fragment)) {
|
|
44
|
+
super.popToFragmentSync(fragment, completion, TransitionAnimation.None);
|
|
45
|
+
return;
|
|
51
46
|
}
|
|
52
47
|
super.popToFragmentSync(fragment, completion, animation);
|
|
53
48
|
}
|
|
54
49
|
|
|
55
50
|
@Override
|
|
56
51
|
protected void redirectToFragmentSync(@NonNull AwesomeFragment fragment, @NonNull Runnable completion, @NonNull TransitionAnimation animation, @Nullable AwesomeFragment from) {
|
|
57
|
-
if (fragment instanceof HybridFragment hybridFragment) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
52
|
+
if (fragment instanceof HybridFragment hybridFragment && !hybridFragment.shouldAnimatedTransition()) {
|
|
53
|
+
super.redirectToFragmentSync(fragment, completion, TransitionAnimation.None, from);
|
|
54
|
+
return;
|
|
62
55
|
}
|
|
63
56
|
super.redirectToFragmentSync(fragment, completion, animation, from);
|
|
64
57
|
}
|
|
58
|
+
|
|
59
|
+
private boolean shouldDisablePopAnimation(@Nullable AwesomeFragment topFragment, @Nullable AwesomeFragment targetFragment) {
|
|
60
|
+
if (topFragment instanceof HybridFragment topHybrid && !topHybrid.getOptions().getBoolean("animatedTransition", true)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
if (targetFragment != null) {
|
|
64
|
+
HybridFragment targetPrimary = targetFragment instanceof HybridFragment hf
|
|
65
|
+
? hf
|
|
66
|
+
: reactManager.primaryFragment(targetFragment);
|
|
67
|
+
if (targetPrimary != null) {
|
|
68
|
+
OrientationCoordinator coordinator = targetPrimary.getOrientationCoordinator();
|
|
69
|
+
if (coordinator != null && coordinator.requiresOrientationChange(targetPrimary)) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
65
76
|
}
|