hybrid-navigation 4.1.0 → 5.0.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 +9 -1
- package/README.md +12 -4
- package/android/build.gradle +4 -4
- package/android/proguard-rules.pro +0 -14
- package/android/src/main/java/com/navigation/androidx/AwesomeActivity.java +114 -23
- package/android/src/main/java/com/navigation/androidx/AwesomeFragment.java +115 -12
- package/android/src/main/java/com/navigation/androidx/DrawableUtils.java +83 -18
- package/android/src/main/java/com/navigation/androidx/DrawerFragment.java +185 -25
- package/android/src/main/java/com/navigation/androidx/FragmentHelper.java +11 -0
- package/android/src/main/java/com/navigation/androidx/HybridDrawerLayout.java +563 -143
- package/android/src/main/java/com/navigation/androidx/LifecycleDelegate.java +39 -12
- package/android/src/main/java/com/navigation/androidx/PresentableActivity.java +3 -0
- package/android/src/main/java/com/navigation/androidx/PresentationDelegate.java +8 -3
- package/android/src/main/java/com/navigation/androidx/StackDelegate.java +29 -9
- package/android/src/main/java/com/navigation/androidx/StackFragment.java +28 -3
- package/android/src/main/java/com/navigation/androidx/SystemUI.java +59 -90
- package/android/src/main/java/com/navigation/androidx/TabBar.java +21 -2
- package/android/src/main/java/com/navigation/androidx/TabBarFragment.java +24 -7
- package/android/src/main/java/com/navigation/androidx/TabView.java +11 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/DispatchResult.java +59 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +18 -10
- package/android/src/main/java/com/reactnative/hybridnavigation/GlobalStyle.java +15 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDRootView.java +3 -8
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +113 -6
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridNavigationPackage.java +13 -24
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeEvent.java +5 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeNavigation.java +196 -194
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationCommandQueue.java +499 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/Navigator.java +4 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/OrientationCoordinator.java +162 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivity.java +103 -66
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +50 -89
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactManager.java +156 -77
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactStackFragment.java +6 -6
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarProvider.java +8 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/SceneLifecycleState.java +21 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/SceneLifecycleStateMachine.java +116 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ScreenOrientation.java +42 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/Utils.java +17 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/DrawerNavigator.java +14 -6
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +62 -22
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +35 -16
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +16 -13
- package/dist/DeepLink.d.ts +3 -2
- package/dist/DeepLink.js +37 -14
- package/dist/NativeEvent.d.ts +4 -12
- package/dist/NativeNavigation.d.ts +17 -19
- package/dist/Navigation.d.ts +21 -19
- package/dist/Navigation.js +83 -89
- package/dist/NavigationComponentWrap.d.ts +4 -3
- package/dist/NavigationComponentWrap.js +3 -6
- package/dist/Navigator.d.ts +31 -42
- package/dist/Navigator.js +97 -90
- package/dist/Options.d.ts +3 -1
- package/dist/Route.d.ts +85 -18
- package/dist/handler/DispatchCommandHandler.d.ts +10 -6
- package/dist/handler/DispatchCommandHandler.js +41 -17
- package/dist/handler/LayoutCommandHandler.d.ts +7 -7
- package/dist/handler/LayoutCommandHandler.js +21 -15
- package/dist/handler/LifecycleEventHandler.d.ts +26 -0
- package/dist/handler/LifecycleEventHandler.js +136 -0
- package/dist/handler/ResultEventHandler.d.ts +14 -9
- package/dist/handler/ResultEventHandler.js +88 -13
- package/dist/hooks.d.ts +5 -2
- package/dist/hooks.js +26 -4
- package/dist/index.d.ts +13 -0
- package/dist/index.js +0 -2
- package/dist/routeConfigRegistry.d.ts +6 -0
- package/dist/routeConfigRegistry.js +19 -0
- package/dist/router/drawer.d.ts +2 -2
- package/dist/router/drawer.js +6 -3
- package/dist/router/index.d.ts +8 -5
- package/dist/router/index.js +127 -43
- package/dist/router/screen.d.ts +2 -2
- package/dist/router/screen.js +1 -1
- package/dist/router/stack.d.ts +2 -2
- package/dist/router/stack.js +59 -30
- package/dist/router/tabs.d.ts +2 -2
- package/dist/router/tabs.js +4 -1
- package/dist/store.d.ts +2 -2
- package/ios/HBDGlobalStyle.h +26 -0
- package/ios/{GlobalStyle.mm → HBDGlobalStyle.mm} +30 -29
- package/ios/HybridNavigation.h +4 -1
- package/ios/Navigator/HBDDrawerNavigator.mm +24 -8
- package/ios/Navigator/HBDNavigatorRegistry.mm +1 -0
- package/ios/Navigator/HBDScreenNavigator.mm +106 -52
- package/ios/Navigator/HBDStackNavigator.mm +109 -61
- package/ios/Navigator/HBDTabNavigator.mm +32 -14
- package/ios/React/HBDNativeNavigation.mm +109 -131
- package/ios/React/HBDNavigator.h +29 -5
- package/ios/React/HBDOrientationCoordinator.h +27 -0
- package/ios/React/HBDOrientationCoordinator.mm +282 -0
- package/ios/React/HBDReactBridgeManager.h +36 -20
- package/ios/React/HBDReactBridgeManager.mm +450 -108
- package/ios/React/HBDSceneLifecycleStateMachine.h +38 -0
- package/ios/React/HBDSceneLifecycleStateMachine.mm +180 -0
- package/ios/View/HBDRootView.h +2 -0
- package/ios/View/HBDRootView.mm +148 -0
- package/ios/View/UIImage+WithBadge.h +3 -3
- package/ios/View/UIImage+WithBadge.mm +10 -15
- package/ios/ViewController/HBDDrawerController.mm +126 -5
- package/ios/ViewController/HBDNavigationController.mm +17 -4
- package/ios/ViewController/HBDReactViewController.mm +59 -121
- package/ios/ViewController/HBDTabBarController.h +4 -0
- package/ios/ViewController/HBDTabBarController.mm +59 -44
- package/ios/ViewController/HBDViewController.h +10 -3
- package/ios/ViewController/HBDViewController.mm +161 -159
- package/ios/ViewController/UINavigationController+HBD.h +2 -2
- package/ios/ViewController/UINavigationController+HBD.mm +3 -3
- package/ios/ViewController/UIViewController+HBD.h +17 -10
- package/ios/ViewController/UIViewController+HBD.mm +85 -69
- package/package.json +1 -1
- package/src/DeepLink.ts +41 -14
- package/src/NativeEvent.ts +4 -14
- package/src/NativeNavigation.ts +22 -33
- package/src/Navigation.ts +162 -121
- package/src/NavigationComponentWrap.tsx +9 -9
- package/src/Navigator.ts +191 -153
- package/src/Options.ts +3 -1
- package/src/Route.ts +134 -19
- package/src/handler/DispatchCommandHandler.ts +55 -21
- package/src/handler/LayoutCommandHandler.ts +36 -17
- package/src/handler/LifecycleEventHandler.ts +172 -0
- package/src/handler/ResultEventHandler.ts +112 -19
- package/src/hooks.ts +39 -7
- package/src/index.ts +26 -2
- package/src/routeConfigRegistry.ts +26 -0
- package/src/router/drawer.ts +8 -5
- package/src/router/index.ts +161 -50
- package/src/router/screen.ts +3 -3
- package/src/router/stack.ts +80 -29
- package/src/router/tabs.ts +15 -7
- package/src/store.ts +1 -1
- package/android/src/main/java/androidx/fragment/app/InternalFragment.java +0 -22
- package/android/src/main/java/com/navigation/androidx/SystemUI30.java +0 -87
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeGarden.java +0 -176
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBar.java +0 -130
- package/android/src/main/res/layout/nav_tab_bar_react.xml +0 -32
- package/android/src/main/res/layout/nav_tab_bar_react_indeterminate.xml +0 -32
- package/dist/NativeGarden.d.ts +0 -13
- package/dist/NativeGarden.js +0 -2
- package/dist/handler/VisibilityEventHandler.d.ts +0 -13
- package/dist/handler/VisibilityEventHandler.js +0 -39
- package/ios/GlobalStyle.h +0 -15
- package/ios/React/HBDNativeGarden.h +0 -10
- package/ios/React/HBDNativeGarden.mm +0 -111
- package/src/NativeGarden.ts +0 -16
- package/src/handler/VisibilityEventHandler.ts +0 -52
package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java
CHANGED
|
@@ -6,13 +6,13 @@ import androidx.annotation.NonNull;
|
|
|
6
6
|
import androidx.annotation.Nullable;
|
|
7
7
|
|
|
8
8
|
import com.facebook.react.bridge.Arguments;
|
|
9
|
-
import com.facebook.react.bridge.Callback;
|
|
10
9
|
import com.facebook.react.bridge.ReadableMap;
|
|
11
10
|
import com.navigation.androidx.AwesomeFragment;
|
|
12
11
|
import com.navigation.androidx.FragmentHelper;
|
|
13
12
|
import com.navigation.androidx.PresentableActivity;
|
|
14
13
|
import com.navigation.androidx.PresentationStyle;
|
|
15
14
|
import com.navigation.androidx.TransitionAnimation;
|
|
15
|
+
import com.reactnative.hybridnavigation.DispatchResult;
|
|
16
16
|
import com.reactnative.hybridnavigation.HybridFragment;
|
|
17
17
|
import com.reactnative.hybridnavigation.Navigator;
|
|
18
18
|
import com.reactnative.hybridnavigation.ReactManager;
|
|
@@ -108,55 +108,75 @@ public class ScreenNavigator implements Navigator {
|
|
|
108
108
|
case "showModalLayout":
|
|
109
109
|
handleShowModalLayout(target, extras, callback);
|
|
110
110
|
break;
|
|
111
|
-
|
|
111
|
+
default:
|
|
112
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unsupported screen action: " + action));
|
|
113
|
+
break;
|
|
112
114
|
}
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
private void handleShowModalLayout(@NonNull AwesomeFragment presenting, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
116
118
|
AwesomeFragment presented = presenting.getPresentedFragment();
|
|
117
119
|
if (presented != null) {
|
|
118
|
-
callback.invoke(
|
|
120
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_ALREADY_PRESENTING, "Target scene is already presenting another scene."));
|
|
119
121
|
return;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
|
-
ReadableMap layout = extras.getMap("layout");
|
|
124
|
+
ReadableMap layout = extras.hasKey("layout") ? extras.getMap("layout") : null;
|
|
123
125
|
presented = getReactManager().createFragment(layout);
|
|
124
126
|
if (presented == null) {
|
|
125
|
-
callback.invoke(
|
|
127
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create modal layout."));
|
|
126
128
|
return;
|
|
127
129
|
}
|
|
130
|
+
Bundle args = FragmentHelper.getArguments(presented);
|
|
131
|
+
args.putString(PresentableActivity.ARG_PRESENTING_SCENE_ID, presenting.getSceneId());
|
|
132
|
+
presented.setArguments(args);
|
|
128
133
|
presented.setPresentationStyle(PresentationStyle.OverFullScreen);
|
|
129
|
-
int requestCode = extras
|
|
130
|
-
presenting.presentFragment(presented, requestCode, () -> callback.invoke(
|
|
134
|
+
int requestCode = getRequestCode(extras);
|
|
135
|
+
presenting.presentFragment(presented, requestCode, () -> callback.invoke(DispatchResult.ok()), TransitionAnimation.None);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
private boolean isInsideModal(@NonNull AwesomeFragment fragment) {
|
|
139
|
+
AwesomeFragment current = fragment;
|
|
140
|
+
while (current != null) {
|
|
141
|
+
if (current.getPresentationStyle() == PresentationStyle.OverFullScreen) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
current = current.getParentAwesomeFragment();
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
131
147
|
}
|
|
132
148
|
|
|
133
149
|
private void handlePresentLayout(@NonNull AwesomeFragment presenting, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
150
|
+
if (isInsideModal(presenting)) {
|
|
151
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Cannot present a scene on top of a modal."));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
134
154
|
AwesomeFragment presented = presenting.getPresentedFragment();
|
|
135
155
|
if (presented != null) {
|
|
136
|
-
callback.invoke(
|
|
156
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_ALREADY_PRESENTING, "Target scene is already presenting another scene."));
|
|
137
157
|
return;
|
|
138
158
|
}
|
|
139
159
|
|
|
140
|
-
ReadableMap layout = extras.getMap("layout");
|
|
160
|
+
ReadableMap layout = extras.hasKey("layout") ? extras.getMap("layout") : null;
|
|
141
161
|
presented = getReactManager().createFragment(layout);
|
|
142
162
|
if (presented == null) {
|
|
143
|
-
callback.invoke(
|
|
163
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create presented layout."));
|
|
144
164
|
return;
|
|
145
165
|
}
|
|
146
|
-
int requestCode = extras
|
|
147
|
-
presenting.presentFragment(presented, requestCode, () -> callback.invoke(
|
|
166
|
+
int requestCode = getRequestCode(extras);
|
|
167
|
+
presenting.presentFragment(presented, requestCode, () -> callback.invoke(DispatchResult.ok()));
|
|
148
168
|
}
|
|
149
169
|
|
|
150
170
|
private void handleShowModal(@NonNull AwesomeFragment presenting, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
151
171
|
AwesomeFragment presented = presenting.getPresentedFragment();
|
|
152
172
|
if (presented != null) {
|
|
153
|
-
callback.invoke(
|
|
173
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_ALREADY_PRESENTING, "Target scene is already presenting another scene."));
|
|
154
174
|
return;
|
|
155
175
|
}
|
|
156
176
|
|
|
157
177
|
presented = createFragmentWithExtras(extras);
|
|
158
178
|
if (presented == null) {
|
|
159
|
-
callback.invoke(
|
|
179
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create modal screen."));
|
|
160
180
|
return;
|
|
161
181
|
}
|
|
162
182
|
|
|
@@ -165,28 +185,41 @@ public class ScreenNavigator implements Navigator {
|
|
|
165
185
|
presented.setArguments(args);
|
|
166
186
|
presented.setPresentationStyle(PresentationStyle.OverFullScreen);
|
|
167
187
|
|
|
168
|
-
int requestCode = extras
|
|
169
|
-
presenting.presentFragment(presented, requestCode, () -> callback.invoke(
|
|
188
|
+
int requestCode = getRequestCode(extras);
|
|
189
|
+
presenting.presentFragment(presented, requestCode, () -> callback.invoke(DispatchResult.ok()), TransitionAnimation.None);
|
|
170
190
|
}
|
|
171
191
|
|
|
172
192
|
private void handleHideModal(@NonNull AwesomeFragment presented, @NonNull Callback callback) {
|
|
173
|
-
presented
|
|
193
|
+
handleDismissInternal(presented, callback);
|
|
174
194
|
}
|
|
175
195
|
|
|
176
196
|
private void handleDismiss(@NonNull AwesomeFragment presented, @NonNull Callback callback) {
|
|
177
|
-
presented
|
|
197
|
+
handleDismissInternal(presented, callback);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
private void handleDismissInternal(@NonNull AwesomeFragment presented, @NonNull Callback callback) {
|
|
201
|
+
if (presented.getPresentingFragment() == null && presented.getPresentedFragment() == null) {
|
|
202
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Nothing to dismiss."));
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
TransitionAnimation animation = isInsideModal(presented) ? TransitionAnimation.None : TransitionAnimation.Present;
|
|
206
|
+
presented.dismissFragment(() -> callback.invoke(DispatchResult.ok()), animation);
|
|
178
207
|
}
|
|
179
208
|
|
|
180
209
|
private void handlePresent(@NonNull AwesomeFragment presenting, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
210
|
+
if (isInsideModal(presenting)) {
|
|
211
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Cannot present a scene on top of a modal."));
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
181
214
|
AwesomeFragment presented = presenting.getPresentedFragment();
|
|
182
215
|
if (presented != null) {
|
|
183
|
-
callback.invoke(
|
|
216
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_ALREADY_PRESENTING, "Target scene is already presenting another scene."));
|
|
184
217
|
return;
|
|
185
218
|
}
|
|
186
219
|
|
|
187
220
|
presented = createFragmentWithExtras(extras);
|
|
188
221
|
if (presented == null) {
|
|
189
|
-
callback.invoke(
|
|
222
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create presented screen."));
|
|
190
223
|
return;
|
|
191
224
|
}
|
|
192
225
|
|
|
@@ -194,10 +227,17 @@ public class ScreenNavigator implements Navigator {
|
|
|
194
227
|
args.putString(PresentableActivity.ARG_PRESENTING_SCENE_ID, presenting.getSceneId());
|
|
195
228
|
presented.setArguments(args);
|
|
196
229
|
|
|
197
|
-
int requestCode = extras
|
|
230
|
+
int requestCode = getRequestCode(extras);
|
|
198
231
|
ReactStackFragment stackFragment = new ReactStackFragment();
|
|
199
232
|
stackFragment.setRootFragment(presented);
|
|
200
|
-
presenting.presentFragment(stackFragment, requestCode, () -> callback.invoke(
|
|
233
|
+
presenting.presentFragment(stackFragment, requestCode, () -> callback.invoke(DispatchResult.ok()));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
private int getRequestCode(@NonNull ReadableMap extras) {
|
|
237
|
+
if (extras.hasKey("requestCode") && !extras.isNull("requestCode")) {
|
|
238
|
+
return extras.getInt("requestCode");
|
|
239
|
+
}
|
|
240
|
+
return 0;
|
|
201
241
|
}
|
|
202
242
|
|
|
203
243
|
private AwesomeFragment createFragmentWithExtras(@NonNull ReadableMap extras) {
|
package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java
CHANGED
|
@@ -9,7 +9,6 @@ import androidx.fragment.app.Fragment;
|
|
|
9
9
|
import androidx.fragment.app.FragmentManager;
|
|
10
10
|
|
|
11
11
|
import com.facebook.react.bridge.Arguments;
|
|
12
|
-
import com.facebook.react.bridge.Callback;
|
|
13
12
|
import com.facebook.react.bridge.ReadableArray;
|
|
14
13
|
import com.facebook.react.bridge.ReadableMap;
|
|
15
14
|
import com.navigation.androidx.AwesomeFragment;
|
|
@@ -17,6 +16,7 @@ import com.navigation.androidx.DrawerFragment;
|
|
|
17
16
|
import com.navigation.androidx.StackFragment;
|
|
18
17
|
import com.navigation.androidx.TabBarFragment;
|
|
19
18
|
import com.navigation.androidx.TransitionAnimation;
|
|
19
|
+
import com.reactnative.hybridnavigation.DispatchResult;
|
|
20
20
|
import com.reactnative.hybridnavigation.HybridFragment;
|
|
21
21
|
import com.reactnative.hybridnavigation.Navigator;
|
|
22
22
|
import com.reactnative.hybridnavigation.ReactManager;
|
|
@@ -112,7 +112,7 @@ public class StackNavigator implements Navigator {
|
|
|
112
112
|
public void handleNavigation(@NonNull AwesomeFragment target, @NonNull String action, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
113
113
|
StackFragment stackFragment = getStackFragment(target);
|
|
114
114
|
if (stackFragment == null) {
|
|
115
|
-
callback.invoke(
|
|
115
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Target scene is not inside a navigation stack."));
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -121,13 +121,13 @@ public class StackNavigator implements Navigator {
|
|
|
121
121
|
handlePush(stackFragment, extras, callback);
|
|
122
122
|
break;
|
|
123
123
|
case "pop":
|
|
124
|
-
stackFragment.popFragment(() -> callback.invoke(
|
|
124
|
+
stackFragment.popFragment(() -> callback.invoke(DispatchResult.ok()));
|
|
125
125
|
break;
|
|
126
126
|
case "popTo":
|
|
127
127
|
handlePopTo(stackFragment, extras, callback);
|
|
128
128
|
break;
|
|
129
129
|
case "popToRoot":
|
|
130
|
-
stackFragment.popToRootFragment(() -> callback.invoke(
|
|
130
|
+
stackFragment.popToRootFragment(() -> callback.invoke(DispatchResult.ok()));
|
|
131
131
|
break;
|
|
132
132
|
case "redirectTo":
|
|
133
133
|
handleRedirectTo(stackFragment, extras, target, callback);
|
|
@@ -135,6 +135,9 @@ public class StackNavigator implements Navigator {
|
|
|
135
135
|
case "pushLayout":
|
|
136
136
|
handlePushLayout(stackFragment, extras, callback);
|
|
137
137
|
break;
|
|
138
|
+
default:
|
|
139
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unsupported stack action: " + action));
|
|
140
|
+
break;
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
|
|
@@ -142,36 +145,40 @@ public class StackNavigator implements Navigator {
|
|
|
142
145
|
ReadableMap layout = extras.getMap("layout");
|
|
143
146
|
AwesomeFragment fragment = getReactManager().createFragment(layout);
|
|
144
147
|
if (fragment == null) {
|
|
145
|
-
callback.invoke(
|
|
148
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create layout for pushLayout."));
|
|
146
149
|
return;
|
|
147
150
|
}
|
|
148
|
-
|
|
151
|
+
int requestCode = getRequestCode(extras);
|
|
152
|
+
if (requestCode != 0) {
|
|
153
|
+
fragment.setRequestCode(requestCode);
|
|
154
|
+
}
|
|
155
|
+
stackFragment.pushFragment(fragment, () -> callback.invoke(DispatchResult.ok()));
|
|
149
156
|
}
|
|
150
157
|
|
|
151
158
|
private void handleRedirectTo(@NonNull StackFragment stackFragment, @NonNull ReadableMap extras, @NonNull AwesomeFragment target, @NonNull Callback callback) {
|
|
152
159
|
AwesomeFragment fragment = createFragmentWithExtras(extras);
|
|
153
160
|
if (fragment == null) {
|
|
154
|
-
callback.invoke(
|
|
161
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create target screen for redirectTo."));
|
|
155
162
|
return;
|
|
156
163
|
}
|
|
157
|
-
stackFragment.redirectToFragment(fragment, () -> callback.invoke(
|
|
164
|
+
stackFragment.redirectToFragment(fragment, () -> callback.invoke(DispatchResult.ok()), TransitionAnimation.Redirect, target);
|
|
158
165
|
}
|
|
159
166
|
|
|
160
167
|
private void handlePopTo(@NonNull StackFragment stackFragment, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
161
168
|
String moduleName = extras.getString("moduleName");
|
|
162
169
|
if (moduleName == null) {
|
|
163
|
-
callback.invoke(
|
|
170
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "moduleName is required for popTo."));
|
|
164
171
|
return;
|
|
165
172
|
}
|
|
166
173
|
|
|
167
174
|
FragmentManager fragmentManager = stackFragment.getChildFragmentManager();
|
|
168
175
|
AwesomeFragment fragment = findFragmentForPopTo(moduleName, inclusive(extras), fragmentManager);
|
|
169
176
|
if (fragment == null) {
|
|
170
|
-
callback.invoke(
|
|
177
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_SCENE_NOT_FOUND, "Can't find target scene to popTo: " + moduleName));
|
|
171
178
|
return;
|
|
172
179
|
}
|
|
173
180
|
|
|
174
|
-
stackFragment.popToFragment(fragment, () -> callback.invoke(
|
|
181
|
+
stackFragment.popToFragment(fragment, () -> callback.invoke(DispatchResult.ok()));
|
|
175
182
|
}
|
|
176
183
|
|
|
177
184
|
private boolean inclusive(@NonNull ReadableMap extras) {
|
|
@@ -191,11 +198,12 @@ public class StackNavigator implements Navigator {
|
|
|
191
198
|
}
|
|
192
199
|
|
|
193
200
|
Fragment fragment = fragmentManager.findFragmentByTag(entry.getName());
|
|
194
|
-
if (!(fragment instanceof
|
|
201
|
+
if (!(fragment instanceof AwesomeFragment awesomeFragment)) {
|
|
195
202
|
continue;
|
|
196
203
|
}
|
|
197
204
|
|
|
198
|
-
|
|
205
|
+
boolean match = moduleName.equals(awesomeFragment.getSceneId())
|
|
206
|
+
|| (awesomeFragment instanceof HybridFragment hybridFragment && moduleName.equals(hybridFragment.getModuleName()));
|
|
199
207
|
if (!match) {
|
|
200
208
|
continue;
|
|
201
209
|
}
|
|
@@ -204,7 +212,7 @@ public class StackNavigator implements Navigator {
|
|
|
204
212
|
FragmentManager.BackStackEntry e = fragmentManager.getBackStackEntryAt(i - 1);
|
|
205
213
|
return (AwesomeFragment) fragmentManager.findFragmentByTag(e.getName());
|
|
206
214
|
}
|
|
207
|
-
return
|
|
215
|
+
return awesomeFragment;
|
|
208
216
|
}
|
|
209
217
|
|
|
210
218
|
return null;
|
|
@@ -213,10 +221,21 @@ public class StackNavigator implements Navigator {
|
|
|
213
221
|
private void handlePush(@NonNull StackFragment stackFragment, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
214
222
|
AwesomeFragment fragment = createFragmentWithExtras(extras);
|
|
215
223
|
if (fragment == null) {
|
|
216
|
-
callback.invoke(
|
|
224
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create target screen for push."));
|
|
217
225
|
return;
|
|
218
226
|
}
|
|
219
|
-
|
|
227
|
+
int requestCode = getRequestCode(extras);
|
|
228
|
+
if (requestCode != 0) {
|
|
229
|
+
fragment.setRequestCode(requestCode);
|
|
230
|
+
}
|
|
231
|
+
stackFragment.pushFragment(fragment, () -> callback.invoke(DispatchResult.ok()));
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
private int getRequestCode(@NonNull ReadableMap extras) {
|
|
235
|
+
if (extras.hasKey("requestCode")) {
|
|
236
|
+
return extras.getInt("requestCode");
|
|
237
|
+
}
|
|
238
|
+
return 0;
|
|
220
239
|
}
|
|
221
240
|
|
|
222
241
|
private AwesomeFragment createFragmentWithExtras(@NonNull ReadableMap extras) {
|
|
@@ -5,13 +5,13 @@ import android.os.Bundle;
|
|
|
5
5
|
import androidx.annotation.NonNull;
|
|
6
6
|
import androidx.annotation.Nullable;
|
|
7
7
|
|
|
8
|
-
import com.facebook.react.bridge.Callback;
|
|
9
8
|
import com.facebook.react.bridge.ReadableArray;
|
|
10
9
|
import com.facebook.react.bridge.ReadableMap;
|
|
11
10
|
import com.navigation.androidx.AwesomeFragment;
|
|
12
11
|
import com.navigation.androidx.StackFragment;
|
|
13
12
|
import com.navigation.androidx.TabBarFragment;
|
|
14
13
|
import com.navigation.androidx.TransitionAnimation;
|
|
14
|
+
import com.reactnative.hybridnavigation.DispatchResult;
|
|
15
15
|
import com.reactnative.hybridnavigation.HybridFragment;
|
|
16
16
|
import com.reactnative.hybridnavigation.Navigator;
|
|
17
17
|
import com.reactnative.hybridnavigation.ReactManager;
|
|
@@ -142,33 +142,36 @@ public class TabNavigator implements Navigator {
|
|
|
142
142
|
public void handleNavigation(@NonNull AwesomeFragment target, @NonNull String action, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
143
143
|
TabBarFragment tabBarFragment = target.getTabBarFragment();
|
|
144
144
|
if (tabBarFragment == null) {
|
|
145
|
-
callback.invoke(
|
|
145
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Target scene is not inside a tab bar."));
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
if ("switchTab".equals(action)) {
|
|
150
150
|
handleSwitchTab(tabBarFragment, extras, callback);
|
|
151
|
+
return;
|
|
151
152
|
}
|
|
153
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unsupported tab action: " + action));
|
|
152
154
|
}
|
|
153
155
|
|
|
154
156
|
private void handleSwitchTab(@NonNull TabBarFragment tabBarFragment, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
157
|
+
if (!extras.hasKey("to") || extras.isNull("to")) {
|
|
158
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Tab index is required for switchTab."));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
155
161
|
int to = extras.getInt("to");
|
|
156
|
-
|
|
157
|
-
|
|
162
|
+
int tabCount = tabBarFragment.getChildAwesomeFragments().size();
|
|
163
|
+
if (to < 0 || to >= tabCount) {
|
|
164
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Tab index out of bounds: " + to));
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (tabBarFragment.getSelectedIndex() == to) {
|
|
168
|
+
callback.invoke(DispatchResult.ok());
|
|
158
169
|
return;
|
|
159
170
|
}
|
|
160
171
|
|
|
161
172
|
popToStackRootIfNeeded(extras, tabBarFragment);
|
|
162
173
|
|
|
163
|
-
tabBarFragment.setSelectedIndex(to, () -> callback.invoke(
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
private boolean isSameTab(int to, @NonNull ReadableMap extras) {
|
|
167
|
-
if (!extras.hasKey("from")) {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
int from = extras.getInt("from");
|
|
171
|
-
return from == to;
|
|
174
|
+
tabBarFragment.setSelectedIndex(to, () -> callback.invoke(DispatchResult.ok()));
|
|
172
175
|
}
|
|
173
176
|
|
|
174
177
|
private void popToStackRootIfNeeded(@NonNull ReadableMap extras, TabBarFragment tabBarFragment) {
|
package/dist/DeepLink.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
declare class DeepLinkImpl {
|
|
2
2
|
private active;
|
|
3
|
-
private
|
|
3
|
+
private uriPrefixes;
|
|
4
4
|
private hasHandleInitialURL;
|
|
5
5
|
private subscription;
|
|
6
|
-
activate(uriPrefix: string): void;
|
|
6
|
+
activate(uriPrefix: string | string[]): void;
|
|
7
7
|
deactivate(): void;
|
|
8
|
+
private extractPath;
|
|
8
9
|
private handleLinking;
|
|
9
10
|
}
|
|
10
11
|
export declare const DeepLink: DeepLinkImpl;
|
package/dist/DeepLink.js
CHANGED
|
@@ -2,23 +2,26 @@ import { Linking } from 'react-native';
|
|
|
2
2
|
import { router } from './router';
|
|
3
3
|
class DeepLinkImpl {
|
|
4
4
|
active = 0;
|
|
5
|
-
|
|
5
|
+
uriPrefixes = [];
|
|
6
6
|
hasHandleInitialURL = false;
|
|
7
7
|
subscription = null;
|
|
8
8
|
activate(uriPrefix) {
|
|
9
|
-
|
|
9
|
+
const prefixes = (Array.isArray(uriPrefix) ? uriPrefix : [uriPrefix]).filter(Boolean);
|
|
10
|
+
if (prefixes.length === 0) {
|
|
10
11
|
throw new Error('must pass `uriPrefix` when activate router.');
|
|
11
12
|
}
|
|
13
|
+
this.uriPrefixes = prefixes;
|
|
12
14
|
if (this.active === 0) {
|
|
13
|
-
this.uriPrefix = uriPrefix;
|
|
14
15
|
if (!this.hasHandleInitialURL) {
|
|
15
16
|
this.hasHandleInitialURL = true;
|
|
16
17
|
Linking.getInitialURL()
|
|
17
18
|
.then(url => {
|
|
18
|
-
if (url) {
|
|
19
|
+
if (url && this.active > 0) {
|
|
19
20
|
console.info(`deeplink:${url}`);
|
|
20
|
-
const path =
|
|
21
|
-
|
|
21
|
+
const path = this.extractPath(url);
|
|
22
|
+
if (path) {
|
|
23
|
+
return router.open(path);
|
|
24
|
+
}
|
|
22
25
|
}
|
|
23
26
|
})
|
|
24
27
|
.catch(err => console.error('An error occurred', err));
|
|
@@ -34,22 +37,42 @@ class DeepLinkImpl {
|
|
|
34
37
|
this.subscription.remove();
|
|
35
38
|
this.subscription = null;
|
|
36
39
|
}
|
|
37
|
-
else {
|
|
38
|
-
//@ts-ignore
|
|
39
|
-
Linking.removeEventListener('url', this.handleLinking);
|
|
40
|
-
}
|
|
41
40
|
}
|
|
42
41
|
if (this.active < 0) {
|
|
43
42
|
this.active = 0;
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
extractPath(url) {
|
|
46
|
+
const lowerUrl = url.toLowerCase();
|
|
47
|
+
const matchedPrefix = this.uriPrefixes.find(prefix => {
|
|
48
|
+
const lowerPrefix = prefix.toLowerCase();
|
|
49
|
+
if (!lowerUrl.startsWith(lowerPrefix)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
if (lowerPrefix.endsWith('://') || lowerPrefix.endsWith('/')) {
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
const nextChar = url[prefix.length];
|
|
56
|
+
return (nextChar === undefined ||
|
|
57
|
+
nextChar === '/' ||
|
|
58
|
+
nextChar === '?' ||
|
|
59
|
+
nextChar === '#');
|
|
60
|
+
});
|
|
61
|
+
if (!matchedPrefix) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
let path = url.slice(matchedPrefix.length);
|
|
49
65
|
if (!path.startsWith('/')) {
|
|
50
66
|
path = '/' + path;
|
|
51
67
|
}
|
|
52
|
-
|
|
68
|
+
return path;
|
|
69
|
+
}
|
|
70
|
+
handleLinking = (event) => {
|
|
71
|
+
console.info(`deeplink:${event.url}`);
|
|
72
|
+
const path = this.extractPath(event.url);
|
|
73
|
+
if (path) {
|
|
74
|
+
router.open(path);
|
|
75
|
+
}
|
|
53
76
|
};
|
|
54
77
|
}
|
|
55
78
|
export const DeepLink = new DeepLinkImpl();
|
package/dist/NativeEvent.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { CodegenTypes, TurboModule } from 'react-native';
|
|
2
|
-
export type
|
|
3
|
-
sceneId: string;
|
|
4
|
-
};
|
|
5
|
-
export type ComponentDisappearEvent = {
|
|
2
|
+
export type SceneStateChangeEvent = {
|
|
6
3
|
sceneId: string;
|
|
4
|
+
state: string;
|
|
5
|
+
prevState: string;
|
|
7
6
|
};
|
|
8
7
|
export type ResultEvent = {
|
|
9
8
|
sceneId: string;
|
|
@@ -11,18 +10,11 @@ export type ResultEvent = {
|
|
|
11
10
|
resultCode: number;
|
|
12
11
|
resultData: {};
|
|
13
12
|
};
|
|
14
|
-
export type SwitchTabEvent = {
|
|
15
|
-
sceneId: string;
|
|
16
|
-
from: number;
|
|
17
|
-
to: number;
|
|
18
|
-
};
|
|
19
13
|
export interface Spec extends TurboModule {
|
|
20
14
|
readonly onResult: CodegenTypes.EventEmitter<ResultEvent>;
|
|
21
15
|
readonly willSetRoot: CodegenTypes.EventEmitter<void>;
|
|
22
16
|
readonly didSetRoot: CodegenTypes.EventEmitter<void>;
|
|
23
|
-
readonly
|
|
24
|
-
readonly onComponentAppear: CodegenTypes.EventEmitter<ComponentAppearEvent>;
|
|
25
|
-
readonly onComponentDisappear: CodegenTypes.EventEmitter<ComponentDisappearEvent>;
|
|
17
|
+
readonly onSceneStateChange: CodegenTypes.EventEmitter<SceneStateChangeEvent>;
|
|
26
18
|
}
|
|
27
19
|
declare const _default: Spec;
|
|
28
20
|
export default _default;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { CodegenTypes, TurboModule } from 'react-native';
|
|
2
|
-
type Error = {
|
|
3
|
-
code: string;
|
|
4
|
-
message: string;
|
|
5
|
-
};
|
|
6
2
|
export type LayoutMode = 'modal' | 'present' | 'normal';
|
|
3
|
+
export interface DispatchResultWire {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
code: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
}
|
|
7
8
|
export interface Route {
|
|
8
9
|
sceneId: string;
|
|
9
10
|
moduleName: string;
|
|
@@ -17,13 +18,6 @@ export interface RouteGraph {
|
|
|
17
18
|
mode: LayoutMode;
|
|
18
19
|
children?: RouteGraph[];
|
|
19
20
|
}
|
|
20
|
-
export type RouteMode = 'modal' | 'present' | 'push';
|
|
21
|
-
export interface RouteConfig {
|
|
22
|
-
path?: string;
|
|
23
|
-
dependency?: string;
|
|
24
|
-
mode?: RouteMode;
|
|
25
|
-
}
|
|
26
|
-
export type ResultType = {} | null;
|
|
27
21
|
export interface Spec extends TurboModule {
|
|
28
22
|
getConstants: () => {
|
|
29
23
|
RESULT_OK: number;
|
|
@@ -34,14 +28,18 @@ export interface Spec extends TurboModule {
|
|
|
34
28
|
endRegisterReactComponent: () => void;
|
|
35
29
|
registerReactComponent: (appKey: string, options: CodegenTypes.UnsafeObject) => void;
|
|
36
30
|
signalFirstRenderComplete: (sceneId: string) => void;
|
|
37
|
-
setRoot: (layout: CodegenTypes.UnsafeObject, sticky: boolean
|
|
38
|
-
setResult: (sceneId: string, resultCode: number, data
|
|
39
|
-
dispatch: (sceneId: string, action: string, params: CodegenTypes.UnsafeObject
|
|
40
|
-
currentTab: (sceneId: string
|
|
41
|
-
isStackRoot: (sceneId: string
|
|
42
|
-
findSceneIdByModuleName: (moduleName: string
|
|
43
|
-
currentRoute: (
|
|
44
|
-
routeGraph: (
|
|
31
|
+
setRoot: (layout: CodegenTypes.UnsafeObject, sticky: boolean) => Promise<DispatchResultWire>;
|
|
32
|
+
setResult: (sceneId: string, resultCode: number, data?: CodegenTypes.UnsafeObject | null) => void;
|
|
33
|
+
dispatch: (sceneId: string, action: string, params: CodegenTypes.UnsafeObject) => Promise<DispatchResultWire>;
|
|
34
|
+
currentTab: (sceneId: string) => Promise<number>;
|
|
35
|
+
isStackRoot: (sceneId: string) => Promise<boolean>;
|
|
36
|
+
findSceneIdByModuleName: (moduleName: string) => Promise<string | null>;
|
|
37
|
+
currentRoute: () => Promise<Route | null>;
|
|
38
|
+
routeGraph: () => Promise<RouteGraph[]>;
|
|
39
|
+
setDefaultOptions: (options: CodegenTypes.UnsafeObject) => void;
|
|
40
|
+
updateOptions: (sceneId: string, options: CodegenTypes.UnsafeObject) => void;
|
|
41
|
+
updateTabBar: (sceneId: string, item: CodegenTypes.UnsafeObject) => void;
|
|
42
|
+
setTabItem: (sceneId: string, items: Array<CodegenTypes.UnsafeObject>) => void;
|
|
45
43
|
}
|
|
46
44
|
declare const _default: Spec;
|
|
47
45
|
export default _default;
|
package/dist/Navigation.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import { ComponentProvider } from 'react-native';
|
|
3
3
|
import type { DefaultOptions, NavigationOption, TabBarStyle, TabItemInfo } from './Options';
|
|
4
|
-
import type { BuildInLayout, Layout, Route, RouteGraph,
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import type { BuildInLayout, DispatchResult, Layout, NavigationResult, ResultMap, Route, RouteConfig, RouteGraph, RouteName, SceneLifecycleState, SetRootOptions } from './Route';
|
|
5
|
+
import { RootLayoutListener } from './handler/LayoutCommandHandler';
|
|
6
|
+
import { RESULT_BLOCK, RESULT_CANCEL, RESULT_OK } from './handler/ResultEventHandler';
|
|
7
|
+
import { GlobalSceneLifecycleListener, GlobalVisibilityEventListener, SceneLifecycleListener, VisibilityEventListener } from './handler/LifecycleEventHandler';
|
|
7
8
|
export type { ResultType } from './handler/ResultEventHandler';
|
|
8
9
|
import type { DispatchParams, NavigationInterceptor } from './handler/DispatchCommandHandler';
|
|
9
|
-
export type { DispatchParams, NavigationInterceptor } from './handler/DispatchCommandHandler';
|
|
10
|
-
export
|
|
10
|
+
export type { DispatchParams, InterceptParams, NavigationInterceptor, } from './handler/DispatchCommandHandler';
|
|
11
|
+
export type { GlobalSceneLifecycleListener, GlobalVisibilityEventListener, SceneLifecycleListener, VisibilityEventListener, } from './handler/LifecycleEventHandler';
|
|
12
|
+
export type { RootLayoutListener } from './handler/LayoutCommandHandler';
|
|
13
|
+
export { RESULT_CANCEL, RESULT_OK, RESULT_BLOCK };
|
|
11
14
|
export type NavigationSubscription = {
|
|
12
15
|
remove: () => void;
|
|
13
16
|
};
|
|
@@ -15,29 +18,28 @@ export type HOC = (WrappedComponent: React.ComponentType<any>) => React.Componen
|
|
|
15
18
|
export interface Navigation {
|
|
16
19
|
startRegisterComponent(hoc?: HOC): void;
|
|
17
20
|
endRegisterComponent(): void;
|
|
18
|
-
registerComponent(appKey:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
registerComponent<Name extends RouteName = RouteName>(appKey: Name, getComponentFunc: ComponentProvider, routeConfig?: RouteConfig): void;
|
|
22
|
+
addLifecycleListener(sceneId: string, listener: SceneLifecycleListener): NavigationSubscription;
|
|
23
|
+
addGlobalLifecycleListener(listener: GlobalSceneLifecycleListener): NavigationSubscription;
|
|
24
|
+
getSceneState(sceneId: string): SceneLifecycleState;
|
|
21
25
|
addGlobalVisibilityEventListener(listener: GlobalVisibilityEventListener): NavigationSubscription;
|
|
22
26
|
addVisibilityEventListener(sceneId: string, listener: VisibilityEventListener): NavigationSubscription;
|
|
23
|
-
dispatch(sceneId: string, action: string, params?: DispatchParams): Promise<
|
|
24
|
-
|
|
25
|
-
setResult<T extends
|
|
26
|
-
result<T
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
setRootLayoutUpdateListener(willSetRoot?: () => void, didSetRoot?: () => void): void;
|
|
27
|
+
dispatch(sceneId: string, action: string, params?: DispatchParams): Promise<DispatchResult>;
|
|
28
|
+
addInterceptor(interceptor: NavigationInterceptor): NavigationSubscription;
|
|
29
|
+
setResult<T extends ResultMap = ResultMap>(sceneId: string, resultCode: number, data?: T | null): void;
|
|
30
|
+
result<T = unknown>(sceneId: string, requestCode: number): Promise<NavigationResult<T>>;
|
|
31
|
+
setRoot(layout: BuildInLayout | Layout, options?: SetRootOptions): Promise<DispatchResult>;
|
|
32
|
+
addRootLayoutUpdateListener(willSetRoot?: RootLayoutListener, didSetRoot?: RootLayoutListener): NavigationSubscription;
|
|
30
33
|
currentTab(sceneId: string): Promise<number>;
|
|
31
|
-
findSceneIdByModuleName(moduleName:
|
|
34
|
+
findSceneIdByModuleName(moduleName: RouteName): Promise<string | null>;
|
|
32
35
|
isStackRoot(sceneId: string): Promise<boolean>;
|
|
33
|
-
|
|
34
|
-
currentRoute(): Promise<Route>;
|
|
36
|
+
currentRoute(): Promise<Route | null>;
|
|
35
37
|
routeGraph(): Promise<RouteGraph[]>;
|
|
36
38
|
setDefaultOptions(options: DefaultOptions): void;
|
|
37
39
|
updateOptions(sceneId: string, options: NavigationOption): void;
|
|
38
40
|
updateTabBar(sceneId: string, options: TabBarStyle): void;
|
|
39
41
|
setTabItem(sceneId: string, item: TabItemInfo | TabItemInfo[]): void;
|
|
40
|
-
setMenuInteractive(sceneId: string, enabled: boolean):
|
|
42
|
+
setMenuInteractive(sceneId: string, enabled: boolean): Promise<DispatchResult>;
|
|
41
43
|
}
|
|
42
44
|
declare const _default: Navigation;
|
|
43
45
|
export default _default;
|