hybrid-navigation 5.0.0 → 5.1.1
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/src/main/java/com/navigation/androidx/AwesomeActivity.java +2 -4
- package/android/src/main/java/com/navigation/androidx/AwesomeFragment.java +48 -2
- package/android/src/main/java/com/navigation/androidx/DefaultTabBarProvider.java +2 -2
- package/android/src/main/java/com/navigation/androidx/FragmentHelper.java +7 -0
- package/android/src/main/java/com/navigation/androidx/PresentationDelegate.java +2 -4
- package/android/src/main/java/com/navigation/androidx/StackFragment.java +3 -0
- package/android/src/main/java/com/navigation/androidx/TabBarFragment.java +50 -0
- package/android/src/main/java/com/navigation/androidx/TabBarItem.java +4 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/DispatchResult.java +16 -4
- package/android/src/main/java/com/reactnative/hybridnavigation/GlobalStyle.java +19 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDRootView.java +17 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +66 -7
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeNavigation.java +116 -18
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationCommandQueue.java +8 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +376 -8
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactManager.java +72 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarFragment.java +26 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +134 -12
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +35 -3
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +29 -4
- package/dist/NativeEvent.d.ts +15 -0
- package/dist/NativeNavigation.d.ts +8 -0
- package/dist/Navigation.d.ts +14 -1
- package/dist/Navigation.js +153 -12
- package/dist/NavigationComponentWrap.d.ts +3 -2
- package/dist/Navigator.d.ts +3 -2
- package/dist/Navigator.js +28 -9
- package/dist/Options.d.ts +12 -2
- package/dist/Route.d.ts +70 -5
- package/dist/defineRoutes.d.ts +19 -0
- package/dist/defineRoutes.js +6 -0
- package/dist/handler/DispatchCommandHandler.d.ts +16 -1
- package/dist/handler/DispatchCommandHandler.js +63 -5
- package/dist/handler/LayoutCommandHandler.d.ts +1 -0
- package/dist/handler/LayoutCommandHandler.js +3 -0
- package/dist/handler/LeaveGuardHandler.d.ts +17 -0
- package/dist/handler/LeaveGuardHandler.js +350 -0
- package/dist/handler/LifecycleEventHandler.d.ts +7 -3
- package/dist/handler/LifecycleEventHandler.js +36 -3
- package/dist/handler/PresentationCoordinator.d.ts +24 -0
- package/dist/handler/PresentationCoordinator.js +456 -0
- package/dist/handler/ResultEventHandler.d.ts +7 -0
- package/dist/handler/ResultEventHandler.js +13 -5
- package/dist/handler/TabEventHandler.d.ts +8 -0
- package/dist/handler/TabEventHandler.js +25 -0
- package/dist/hooks.d.ts +3 -1
- package/dist/hooks.js +20 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +3 -0
- package/dist/reveal.d.ts +46 -0
- package/dist/reveal.js +431 -0
- package/dist/routeGraph.d.ts +12 -0
- package/dist/routeGraph.js +68 -0
- package/dist/router/index.js +5 -41
- package/dist/router/tabs.d.ts +1 -0
- package/dist/store.d.ts +2 -0
- package/dist/store.js +4 -0
- package/dist/testing.d.ts +79 -0
- package/dist/testing.js +251 -0
- package/ios/HBDGlobalStyle.h +3 -0
- package/ios/HBDGlobalStyle.mm +13 -0
- package/ios/HybridNavigation.h +1 -0
- package/ios/Navigator/HBDScreenNavigator.mm +250 -11
- package/ios/Navigator/HBDStackNavigator.mm +50 -7
- package/ios/Navigator/HBDTabNavigator.mm +33 -5
- package/ios/React/HBDNativeNavigation.mm +73 -12
- package/ios/React/HBDNavigator.h +8 -0
- package/ios/React/HBDOrientationCoordinator.h +2 -0
- package/ios/React/HBDOrientationCoordinator.mm +27 -0
- package/ios/React/HBDReactBridgeManager.h +10 -0
- package/ios/React/HBDReactBridgeManager.mm +48 -2
- package/ios/ViewController/HBDNavigationController.mm +14 -0
- package/ios/ViewController/HBDReactViewController.h +6 -0
- package/ios/ViewController/HBDReactViewController.mm +177 -1
- package/ios/ViewController/HBDTabBarController.h +11 -0
- package/ios/ViewController/HBDTabBarController.mm +170 -3
- package/ios/ViewController/HBDTabBarRenderer.h +28 -0
- package/ios/ViewController/HBDViewController.h +1 -0
- package/ios/ViewController/HBDViewController.mm +57 -9
- package/ios/ViewController/UIViewController+HBD.h +1 -0
- package/ios/ViewController/UIViewController+HBD.mm +17 -4
- package/package.json +3 -1
- package/src/NativeEvent.ts +17 -0
- package/src/NativeNavigation.ts +9 -0
- package/src/Navigation.ts +228 -12
- package/src/NavigationComponentWrap.tsx +11 -2
- package/src/Navigator.ts +38 -9
- package/src/Options.ts +9 -2
- package/src/Route.ts +102 -6
- package/src/defineRoutes.ts +46 -0
- package/src/handler/DispatchCommandHandler.ts +110 -11
- package/src/handler/LayoutCommandHandler.ts +4 -0
- package/src/handler/LeaveGuardHandler.ts +436 -0
- package/src/handler/LifecycleEventHandler.ts +85 -38
- package/src/handler/PresentationCoordinator.ts +566 -0
- package/src/handler/ResultEventHandler.ts +23 -9
- package/src/handler/TabEventHandler.ts +31 -0
- package/src/hooks.ts +37 -1
- package/src/index.ts +11 -0
- package/src/reveal.ts +565 -0
- package/src/routeGraph.ts +87 -0
- package/src/router/index.ts +5 -40
- package/src/router/tabs.ts +1 -0
- package/src/store.ts +5 -0
- package/src/testing.ts +395 -0
- package/testing.d.ts +1 -0
- package/testing.js +3 -0
|
@@ -18,7 +18,9 @@ import com.facebook.react.bridge.WritableMap;
|
|
|
18
18
|
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
|
19
19
|
import com.navigation.androidx.AwesomeFragment;
|
|
20
20
|
import com.navigation.androidx.FragmentHelper;
|
|
21
|
+
import com.navigation.androidx.TabBarProvider;
|
|
21
22
|
|
|
23
|
+
import java.lang.ref.WeakReference;
|
|
22
24
|
import java.util.ArrayList;
|
|
23
25
|
import java.util.HashMap;
|
|
24
26
|
import java.util.List;
|
|
@@ -48,6 +50,8 @@ public class ReactManager {
|
|
|
48
50
|
|
|
49
51
|
private final HashMap<String, Class<? extends HybridFragment>> nativeModules = new HashMap<>();
|
|
50
52
|
private final HashMap<String, ReadableMap> reactModules = new HashMap<>();
|
|
53
|
+
private final HashMap<String, Class<? extends TabBarProvider>> tabBarProviders = new HashMap<>();
|
|
54
|
+
private final HashMap<String, WeakReference<ReactFragment>> prewarmingFragments = new HashMap<>();
|
|
51
55
|
private final CopyOnWriteArrayList<ReactModuleRegisterListener> reactModuleRegisterListeners = new CopyOnWriteArrayList<>();
|
|
52
56
|
private final CopyOnWriteArrayList<ReactBridgeReloadListener> reactBridgeReloadListeners = new CopyOnWriteArrayList<>();
|
|
53
57
|
private final NavigatorRegistry navigatorRegistry = new NavigatorRegistry();
|
|
@@ -136,6 +140,48 @@ public class ReactManager {
|
|
|
136
140
|
commandQueue.setViewHierarchyReady(ready);
|
|
137
141
|
}
|
|
138
142
|
|
|
143
|
+
long getRootGeneration() {
|
|
144
|
+
return commandQueue.getRootGeneration();
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
public int getCommandGeneration() {
|
|
148
|
+
return commandQueue.getCommandGeneration();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
void registerPrewarmingFragment(@NonNull ReactFragment fragment) {
|
|
152
|
+
String sceneId = fragment.getSceneId();
|
|
153
|
+
if (sceneId != null && !sceneId.isEmpty()) {
|
|
154
|
+
prewarmingFragments.put(sceneId, new WeakReference<>(fragment));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
void unregisterPrewarmingFragment(@NonNull ReactFragment fragment) {
|
|
159
|
+
String sceneId = fragment.getSceneId();
|
|
160
|
+
if (sceneId == null || sceneId.isEmpty()) {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
WeakReference<ReactFragment> ref = prewarmingFragments.get(sceneId);
|
|
164
|
+
if (ref != null) {
|
|
165
|
+
ReactFragment existing = ref.get();
|
|
166
|
+
if (existing == null || existing == fragment) {
|
|
167
|
+
prewarmingFragments.remove(sceneId);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
@Nullable
|
|
173
|
+
ReactFragment findPrewarmingFragmentBySceneId(@NonNull String sceneId) {
|
|
174
|
+
WeakReference<ReactFragment> ref = prewarmingFragments.get(sceneId);
|
|
175
|
+
if (ref == null) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
ReactFragment fragment = ref.get();
|
|
179
|
+
if (fragment == null) {
|
|
180
|
+
prewarmingFragments.remove(sceneId);
|
|
181
|
+
}
|
|
182
|
+
return fragment;
|
|
183
|
+
}
|
|
184
|
+
|
|
139
185
|
boolean hasQueuedSetRoot() {
|
|
140
186
|
return commandQueue.hasQueuedSetRoot();
|
|
141
187
|
}
|
|
@@ -201,7 +247,11 @@ public class ReactManager {
|
|
|
201
247
|
if (activity == null || !commandQueue.isViewHierarchyReady()) {
|
|
202
248
|
return null;
|
|
203
249
|
}
|
|
204
|
-
|
|
250
|
+
AwesomeFragment fragment = FragmentHelper.findAwesomeFragment(activity.getSupportFragmentManager(), sceneId);
|
|
251
|
+
if (fragment != null) {
|
|
252
|
+
return fragment;
|
|
253
|
+
}
|
|
254
|
+
return findPrewarmingFragmentBySceneId(sceneId);
|
|
205
255
|
}
|
|
206
256
|
|
|
207
257
|
@Nullable
|
|
@@ -294,7 +344,7 @@ public class ReactManager {
|
|
|
294
344
|
}
|
|
295
345
|
|
|
296
346
|
public void addReactBridgeReloadListener(@NonNull ReactBridgeReloadListener listener) {
|
|
297
|
-
reactBridgeReloadListeners.
|
|
347
|
+
reactBridgeReloadListeners.addIfAbsent(listener);
|
|
298
348
|
}
|
|
299
349
|
|
|
300
350
|
public void removeReactBridgeReloadListener(@NonNull ReactBridgeReloadListener listener) {
|
|
@@ -302,12 +352,14 @@ public class ReactManager {
|
|
|
302
352
|
}
|
|
303
353
|
|
|
304
354
|
public void invalidate() {
|
|
355
|
+
prewarmingFragments.clear();
|
|
305
356
|
invokeReloadListeners();
|
|
306
357
|
setReactModuleRegisterCompleted(false);
|
|
307
358
|
commandQueue.invalidate("Navigation host was invalidated.");
|
|
308
359
|
}
|
|
309
360
|
|
|
310
361
|
private void resetStateForReactInit() {
|
|
362
|
+
prewarmingFragments.clear();
|
|
311
363
|
rootLayout = null;
|
|
312
364
|
stickyLayout = null;
|
|
313
365
|
commandQueue.invalidate("React context reinitialized.");
|
|
@@ -497,6 +549,24 @@ public class ReactManager {
|
|
|
497
549
|
navigatorRegistry.register(navigator);
|
|
498
550
|
}
|
|
499
551
|
|
|
552
|
+
public void registerTabBarProvider(@NonNull String name, @NonNull Class<? extends TabBarProvider> providerClass) {
|
|
553
|
+
tabBarProviders.put(name, providerClass);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
@Nullable
|
|
557
|
+
public TabBarProvider createTabBarProvider(@NonNull String name) {
|
|
558
|
+
Class<? extends TabBarProvider> clazz = tabBarProviders.get(name);
|
|
559
|
+
if (clazz == null) {
|
|
560
|
+
return null;
|
|
561
|
+
}
|
|
562
|
+
try {
|
|
563
|
+
return clazz.getDeclaredConstructor().newInstance();
|
|
564
|
+
} catch (Exception e) {
|
|
565
|
+
FLog.e(TAG, "Failed to instantiate TabBarProvider for renderer: " + name, e);
|
|
566
|
+
return null;
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
|
|
500
570
|
public interface MemoryWatcher {
|
|
501
571
|
void watch(Object object);
|
|
502
572
|
}
|
|
@@ -7,6 +7,8 @@ import android.os.Bundle;
|
|
|
7
7
|
import androidx.annotation.NonNull;
|
|
8
8
|
import androidx.annotation.Nullable;
|
|
9
9
|
|
|
10
|
+
import com.facebook.react.bridge.Arguments;
|
|
11
|
+
import com.facebook.react.bridge.WritableMap;
|
|
10
12
|
import com.navigation.androidx.AwesomeFragment;
|
|
11
13
|
import com.navigation.androidx.FragmentHelper;
|
|
12
14
|
import com.navigation.androidx.Style;
|
|
@@ -14,6 +16,7 @@ import com.navigation.androidx.TabBarFragment;
|
|
|
14
16
|
import com.navigation.androidx.TabBarProvider;
|
|
15
17
|
import com.navigation.androidx.TransitionAnimation;
|
|
16
18
|
|
|
19
|
+
import java.util.ArrayList;
|
|
17
20
|
import java.util.List;
|
|
18
21
|
|
|
19
22
|
public class ReactTabBarFragment extends TabBarFragment {
|
|
@@ -102,6 +105,29 @@ public class ReactTabBarFragment extends TabBarFragment {
|
|
|
102
105
|
return new ReactTabBarProvider();
|
|
103
106
|
}
|
|
104
107
|
|
|
108
|
+
@Override
|
|
109
|
+
protected void onTabPressed(int index, int previousIndex, boolean reselected) {
|
|
110
|
+
if (!reactManager.isReactModuleRegisterCompleted()) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
NativeEvent event = NativeEvent.getInstance();
|
|
114
|
+
if (event == null) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
WritableMap payload = Arguments.createMap();
|
|
118
|
+
payload.putInt("index", index);
|
|
119
|
+
payload.putInt("previousIndex", previousIndex);
|
|
120
|
+
payload.putBoolean("reselected", reselected);
|
|
121
|
+
ArrayList<String> keys = getTabKeys();
|
|
122
|
+
if (index >= 0 && index < keys.size()) {
|
|
123
|
+
String key = keys.get(index);
|
|
124
|
+
if (key != null && !key.isEmpty()) {
|
|
125
|
+
payload.putString("tabKey", key);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
event.emitOnTabPress(payload);
|
|
129
|
+
}
|
|
130
|
+
|
|
105
131
|
private Bundle options;
|
|
106
132
|
|
|
107
133
|
@NonNull
|
package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java
CHANGED
|
@@ -11,6 +11,7 @@ import com.navigation.androidx.AwesomeFragment;
|
|
|
11
11
|
import com.navigation.androidx.FragmentHelper;
|
|
12
12
|
import com.navigation.androidx.PresentableActivity;
|
|
13
13
|
import com.navigation.androidx.PresentationStyle;
|
|
14
|
+
import com.navigation.androidx.StackFragment;
|
|
14
15
|
import com.navigation.androidx.TransitionAnimation;
|
|
15
16
|
import com.reactnative.hybridnavigation.DispatchResult;
|
|
16
17
|
import com.reactnative.hybridnavigation.HybridFragment;
|
|
@@ -26,7 +27,7 @@ public class ScreenNavigator implements Navigator {
|
|
|
26
27
|
|
|
27
28
|
final static String TAG = "Navigation";
|
|
28
29
|
|
|
29
|
-
private final List<String> supportActions = Arrays.asList("present", "presentLayout", "dismiss", "showModal", "showModalLayout", "hideModal");
|
|
30
|
+
private final List<String> supportActions = Arrays.asList("present", "presentLayout", "dismiss", "showModal", "showModalLayout", "hideModal", "close");
|
|
30
31
|
|
|
31
32
|
@Override
|
|
32
33
|
@NonNull
|
|
@@ -94,13 +95,13 @@ public class ScreenNavigator implements Navigator {
|
|
|
94
95
|
handlePresent(target, extras, callback);
|
|
95
96
|
break;
|
|
96
97
|
case "dismiss":
|
|
97
|
-
handleDismiss(target, callback);
|
|
98
|
+
handleDismiss(target, extras, callback);
|
|
98
99
|
break;
|
|
99
100
|
case "showModal":
|
|
100
101
|
handleShowModal(target, extras, callback);
|
|
101
102
|
break;
|
|
102
103
|
case "hideModal":
|
|
103
|
-
handleHideModal(target, callback);
|
|
104
|
+
handleHideModal(target, extras, callback);
|
|
104
105
|
break;
|
|
105
106
|
case "presentLayout":
|
|
106
107
|
handlePresentLayout(target, extras, callback);
|
|
@@ -108,12 +109,33 @@ public class ScreenNavigator implements Navigator {
|
|
|
108
109
|
case "showModalLayout":
|
|
109
110
|
handleShowModalLayout(target, extras, callback);
|
|
110
111
|
break;
|
|
112
|
+
case "close":
|
|
113
|
+
handleClose(target, extras, callback);
|
|
114
|
+
break;
|
|
111
115
|
default:
|
|
112
116
|
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unsupported screen action: " + action));
|
|
113
117
|
break;
|
|
114
118
|
}
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
@Nullable
|
|
122
|
+
private String resolvedSceneId(@NonNull AwesomeFragment fragment) {
|
|
123
|
+
HybridFragment primary = getReactManager().primaryFragment(fragment);
|
|
124
|
+
if (primary != null) {
|
|
125
|
+
return primary.getSceneId();
|
|
126
|
+
}
|
|
127
|
+
return fragment.getSceneId();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@NonNull
|
|
131
|
+
private AwesomeFragment resolveModalHost(@NonNull AwesomeFragment fragment) {
|
|
132
|
+
AwesomeFragment host = fragment;
|
|
133
|
+
while (host.getParentAwesomeFragment() != null && !host.definesPresentationContext()) {
|
|
134
|
+
host = host.getParentAwesomeFragment();
|
|
135
|
+
}
|
|
136
|
+
return host;
|
|
137
|
+
}
|
|
138
|
+
|
|
117
139
|
private void handleShowModalLayout(@NonNull AwesomeFragment presenting, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
118
140
|
AwesomeFragment presented = presenting.getPresentedFragment();
|
|
119
141
|
if (presented != null) {
|
|
@@ -132,7 +154,8 @@ public class ScreenNavigator implements Navigator {
|
|
|
132
154
|
presented.setArguments(args);
|
|
133
155
|
presented.setPresentationStyle(PresentationStyle.OverFullScreen);
|
|
134
156
|
int requestCode = getRequestCode(extras);
|
|
135
|
-
|
|
157
|
+
AwesomeFragment finalPresented = presented;
|
|
158
|
+
presenting.presentFragment(presented, requestCode, () -> callback.invoke(DispatchResult.ok(resolvedSceneId(finalPresented))), TransitionAnimation.None);
|
|
136
159
|
}
|
|
137
160
|
|
|
138
161
|
private boolean isInsideModal(@NonNull AwesomeFragment fragment) {
|
|
@@ -164,7 +187,8 @@ public class ScreenNavigator implements Navigator {
|
|
|
164
187
|
return;
|
|
165
188
|
}
|
|
166
189
|
int requestCode = getRequestCode(extras);
|
|
167
|
-
|
|
190
|
+
AwesomeFragment finalPresented = presented;
|
|
191
|
+
presenting.presentFragment(presented, requestCode, () -> callback.invoke(DispatchResult.ok(resolvedSceneId(finalPresented))));
|
|
168
192
|
}
|
|
169
193
|
|
|
170
194
|
private void handleShowModal(@NonNull AwesomeFragment presenting, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
@@ -186,22 +210,119 @@ public class ScreenNavigator implements Navigator {
|
|
|
186
210
|
presented.setPresentationStyle(PresentationStyle.OverFullScreen);
|
|
187
211
|
|
|
188
212
|
int requestCode = getRequestCode(extras);
|
|
189
|
-
|
|
213
|
+
AwesomeFragment finalPresented = presented;
|
|
214
|
+
presenting.presentFragment(presented, requestCode, () -> callback.invoke(DispatchResult.ok(finalPresented.getSceneId())), TransitionAnimation.None);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private void applyPendingResultIfPresent(@NonNull AwesomeFragment target, @NonNull ReadableMap extras) {
|
|
218
|
+
if (!extras.hasKey("result") || extras.isNull("result")) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
ReadableMap pendingResult = extras.getMap("result");
|
|
222
|
+
if (pendingResult == null || !pendingResult.hasKey("code") || pendingResult.isNull("code")) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
int resultCode = pendingResult.getInt("code");
|
|
226
|
+
Bundle resultData = null;
|
|
227
|
+
if (pendingResult.hasKey("data") && !pendingResult.isNull("data")) {
|
|
228
|
+
ReadableMap dataMap = pendingResult.getMap("data");
|
|
229
|
+
if (dataMap != null) {
|
|
230
|
+
resultData = Arguments.toBundle(dataMap);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
target.setResult(resultCode, resultData);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
private boolean isDescendantOrSelf(@NonNull AwesomeFragment fragment, @Nullable AwesomeFragment ancestor) {
|
|
237
|
+
if (ancestor == null) {
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
AwesomeFragment current = fragment;
|
|
241
|
+
while (current != null) {
|
|
242
|
+
if (current == ancestor) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
current = current.getParentAwesomeFragment();
|
|
246
|
+
}
|
|
247
|
+
return false;
|
|
190
248
|
}
|
|
191
249
|
|
|
192
|
-
private void
|
|
193
|
-
|
|
250
|
+
private void handleClose(@NonNull AwesomeFragment target, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
251
|
+
AwesomeFragment host = resolveModalHost(target);
|
|
252
|
+
if (host.getPresentedFragment() != null) {
|
|
253
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_COVERED, "Target scene is covered by another presented scene."));
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
StackFragment stackFragment = target.getStackFragment();
|
|
258
|
+
if (stackFragment != null) {
|
|
259
|
+
AwesomeFragment topFragment = stackFragment.getTopFragment();
|
|
260
|
+
if (!isDescendantOrSelf(target, topFragment)) {
|
|
261
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_COVERED, "Target scene is covered by another screen in the stack."));
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
if (!target.isStackRoot()) {
|
|
265
|
+
applyPendingResultIfPresent(topFragment != null ? topFragment : target, extras);
|
|
266
|
+
getReactManager().handleNavigation(target, "pop", extras, callback);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (host.getPresentingFragment() != null) {
|
|
272
|
+
applyPendingResultIfPresent(target, extras);
|
|
273
|
+
TransitionAnimation animation = isInsideModal(target) ? TransitionAnimation.None : TransitionAnimation.Present;
|
|
274
|
+
host.dismissFragment(() -> callback.invoke(DispatchResult.ok()), animation);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Target scene cannot be closed."));
|
|
194
279
|
}
|
|
195
280
|
|
|
196
|
-
private void
|
|
197
|
-
handleDismissInternal(presented, callback);
|
|
281
|
+
private void handleHideModal(@NonNull AwesomeFragment presented, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
282
|
+
handleDismissInternal(presented, extras, callback);
|
|
198
283
|
}
|
|
199
284
|
|
|
200
|
-
private void
|
|
285
|
+
private void handleDismiss(@NonNull AwesomeFragment presented, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
286
|
+
handleDismissInternal(presented, extras, callback);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
private void handleDismissInternal(@NonNull AwesomeFragment presented, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
290
|
+
String target = extras.hasKey("target") && !extras.isNull("target") ? extras.getString("target") : null;
|
|
291
|
+
AwesomeFragment host = resolveModalHost(presented);
|
|
292
|
+
|
|
293
|
+
if ("self".equals(target)) {
|
|
294
|
+
if (host.getPresentedFragment() != null) {
|
|
295
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_COVERED, "Target scene is covered by another presented scene."));
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if (host.getPresentingFragment() == null) {
|
|
299
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Target scene is not presented."));
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
applyPendingResultIfPresent(presented, extras);
|
|
303
|
+
TransitionAnimation animation = isInsideModal(presented) ? TransitionAnimation.None : TransitionAnimation.Present;
|
|
304
|
+
host.dismissFragment(() -> callback.invoke(DispatchResult.ok()), animation);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if ("presented".equals(target)) {
|
|
309
|
+
AwesomeFragment childPresented = host.getPresentedFragment();
|
|
310
|
+
if (childPresented == null) {
|
|
311
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "No presented scene to dismiss."));
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
TransitionAnimation animation = isInsideModal(childPresented) ? TransitionAnimation.None : TransitionAnimation.Present;
|
|
315
|
+
childPresented.dismissFragment(() -> callback.invoke(DispatchResult.ok()), animation);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
|
|
201
319
|
if (presented.getPresentingFragment() == null && presented.getPresentedFragment() == null) {
|
|
202
320
|
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Nothing to dismiss."));
|
|
203
321
|
return;
|
|
204
322
|
}
|
|
323
|
+
if (presented.getPresentedFragment() == null) {
|
|
324
|
+
applyPendingResultIfPresent(presented, extras);
|
|
325
|
+
}
|
|
205
326
|
TransitionAnimation animation = isInsideModal(presented) ? TransitionAnimation.None : TransitionAnimation.Present;
|
|
206
327
|
presented.dismissFragment(() -> callback.invoke(DispatchResult.ok()), animation);
|
|
207
328
|
}
|
|
@@ -230,7 +351,8 @@ public class ScreenNavigator implements Navigator {
|
|
|
230
351
|
int requestCode = getRequestCode(extras);
|
|
231
352
|
ReactStackFragment stackFragment = new ReactStackFragment();
|
|
232
353
|
stackFragment.setRootFragment(presented);
|
|
233
|
-
|
|
354
|
+
AwesomeFragment finalPresented = presented;
|
|
355
|
+
presenting.presentFragment(stackFragment, requestCode, () -> callback.invoke(DispatchResult.ok(finalPresented.getSceneId())));
|
|
234
356
|
}
|
|
235
357
|
|
|
236
358
|
private int getRequestCode(@NonNull ReadableMap extras) {
|
package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java
CHANGED
|
@@ -2,6 +2,7 @@ package com.reactnative.hybridnavigation.navigator;
|
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle;
|
|
4
4
|
import android.text.TextUtils;
|
|
5
|
+
import android.view.View;
|
|
5
6
|
|
|
6
7
|
import androidx.annotation.NonNull;
|
|
7
8
|
import androidx.annotation.Nullable;
|
|
@@ -19,6 +20,8 @@ import com.navigation.androidx.TransitionAnimation;
|
|
|
19
20
|
import com.reactnative.hybridnavigation.DispatchResult;
|
|
20
21
|
import com.reactnative.hybridnavigation.HybridFragment;
|
|
21
22
|
import com.reactnative.hybridnavigation.Navigator;
|
|
23
|
+
import com.reactnative.hybridnavigation.R;
|
|
24
|
+
import com.reactnative.hybridnavigation.ReactFragment;
|
|
22
25
|
import com.reactnative.hybridnavigation.ReactManager;
|
|
23
26
|
import com.reactnative.hybridnavigation.ReactStackFragment;
|
|
24
27
|
|
|
@@ -28,6 +31,8 @@ import java.util.List;
|
|
|
28
31
|
|
|
29
32
|
public class StackNavigator implements Navigator {
|
|
30
33
|
|
|
34
|
+
private static final long PUSH_PREWARM_TIMEOUT_MS = 280L;
|
|
35
|
+
|
|
31
36
|
private final List<String> supportActions = Arrays.asList("push", "pushLayout", "pop", "popTo", "popToRoot", "redirectTo");
|
|
32
37
|
|
|
33
38
|
@Override
|
|
@@ -152,7 +157,10 @@ public class StackNavigator implements Navigator {
|
|
|
152
157
|
if (requestCode != 0) {
|
|
153
158
|
fragment.setRequestCode(requestCode);
|
|
154
159
|
}
|
|
155
|
-
stackFragment.pushFragment(fragment, () ->
|
|
160
|
+
stackFragment.pushFragment(fragment, () -> {
|
|
161
|
+
HybridFragment primary = getReactManager().primaryFragment(fragment);
|
|
162
|
+
callback.invoke(DispatchResult.ok(primary != null ? primary.getSceneId() : fragment.getSceneId()));
|
|
163
|
+
});
|
|
156
164
|
}
|
|
157
165
|
|
|
158
166
|
private void handleRedirectTo(@NonNull StackFragment stackFragment, @NonNull ReadableMap extras, @NonNull AwesomeFragment target, @NonNull Callback callback) {
|
|
@@ -161,7 +169,7 @@ public class StackNavigator implements Navigator {
|
|
|
161
169
|
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Unable to create target screen for redirectTo."));
|
|
162
170
|
return;
|
|
163
171
|
}
|
|
164
|
-
stackFragment.redirectToFragment(fragment, () -> callback.invoke(DispatchResult.ok()), TransitionAnimation.Redirect, target);
|
|
172
|
+
stackFragment.redirectToFragment(fragment, () -> callback.invoke(DispatchResult.ok(fragment.getSceneId())), TransitionAnimation.Redirect, target);
|
|
165
173
|
}
|
|
166
174
|
|
|
167
175
|
private void handlePopTo(@NonNull StackFragment stackFragment, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
@@ -228,7 +236,31 @@ public class StackNavigator implements Navigator {
|
|
|
228
236
|
if (requestCode != 0) {
|
|
229
237
|
fragment.setRequestCode(requestCode);
|
|
230
238
|
}
|
|
231
|
-
|
|
239
|
+
if (fragment instanceof ReactFragment reactFragment) {
|
|
240
|
+
View stackView = stackFragment.getView();
|
|
241
|
+
View container = stackView != null ? stackView.findViewById(R.id.navigation_content) : null;
|
|
242
|
+
if (container != null) {
|
|
243
|
+
int generation = getReactManager().getCommandGeneration();
|
|
244
|
+
boolean prewarming = reactFragment.prepareForAnimatedPush(stackFragment, container, PUSH_PREWARM_TIMEOUT_MS, () -> {
|
|
245
|
+
if (generation != getReactManager().getCommandGeneration()) {
|
|
246
|
+
reactFragment.cancelPushPrewarm(true);
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
249
|
+
if (!stackFragment.isAdded() || stackFragment.getActivity() == null
|
|
250
|
+
|| stackFragment.getActivity().isFinishing() || stackFragment.getActivity().isDestroyed()
|
|
251
|
+
|| fragment.isAdded()) {
|
|
252
|
+
reactFragment.cancelPushPrewarm(true);
|
|
253
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_HOST_UNAVAILABLE, "Navigation stack is unavailable after push prewarm."));
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
stackFragment.pushFragment(fragment, () -> callback.invoke(DispatchResult.ok(fragment.getSceneId())));
|
|
257
|
+
});
|
|
258
|
+
if (prewarming) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
stackFragment.pushFragment(fragment, () -> callback.invoke(DispatchResult.ok(fragment.getSceneId())));
|
|
232
264
|
}
|
|
233
265
|
|
|
234
266
|
private int getRequestCode(@NonNull ReadableMap extras) {
|
|
@@ -5,11 +5,13 @@ import android.os.Bundle;
|
|
|
5
5
|
import androidx.annotation.NonNull;
|
|
6
6
|
import androidx.annotation.Nullable;
|
|
7
7
|
|
|
8
|
+
import com.facebook.common.logging.FLog;
|
|
8
9
|
import com.facebook.react.bridge.ReadableArray;
|
|
9
10
|
import com.facebook.react.bridge.ReadableMap;
|
|
10
11
|
import com.navigation.androidx.AwesomeFragment;
|
|
11
12
|
import com.navigation.androidx.StackFragment;
|
|
12
13
|
import com.navigation.androidx.TabBarFragment;
|
|
14
|
+
import com.navigation.androidx.TabBarProvider;
|
|
13
15
|
import com.navigation.androidx.TransitionAnimation;
|
|
14
16
|
import com.reactnative.hybridnavigation.DispatchResult;
|
|
15
17
|
import com.reactnative.hybridnavigation.HybridFragment;
|
|
@@ -81,6 +83,18 @@ public class TabNavigator implements Navigator {
|
|
|
81
83
|
tabBarFragment.setSelectedIndex(selectedIndex);
|
|
82
84
|
bundle.putInt("selectedIndex", selectedIndex);
|
|
83
85
|
}
|
|
86
|
+
if (options.hasKey("renderer") && !options.isNull("renderer")) {
|
|
87
|
+
String renderer = options.getString("renderer");
|
|
88
|
+
if (renderer != null && !renderer.isEmpty()) {
|
|
89
|
+
TabBarProvider provider = getReactManager().createTabBarProvider(renderer);
|
|
90
|
+
if (provider != null) {
|
|
91
|
+
tabBarFragment.setTabBarProvider(provider);
|
|
92
|
+
} else {
|
|
93
|
+
FLog.w("Navigation", "Unknown tab bar renderer '" + renderer + "', falling back to default TabBar.");
|
|
94
|
+
}
|
|
95
|
+
bundle.putString("renderer", renderer);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
84
98
|
|
|
85
99
|
tabBarFragment.setOptions(bundle);
|
|
86
100
|
}
|
|
@@ -110,6 +124,7 @@ public class TabNavigator implements Navigator {
|
|
|
110
124
|
graph.putString("layout", name());
|
|
111
125
|
graph.putString("sceneId", fragment.getSceneId());
|
|
112
126
|
graph.putParcelableArrayList("children", children);
|
|
127
|
+
graph.putStringArrayList("tabKeys", tabBarFragment.getTabKeys());
|
|
113
128
|
graph.putString("mode", Navigator.Util.getMode(fragment));
|
|
114
129
|
graph.putInt("selectedIndex", tabBarFragment.getSelectedIndex());
|
|
115
130
|
return graph;
|
|
@@ -154,11 +169,21 @@ public class TabNavigator implements Navigator {
|
|
|
154
169
|
}
|
|
155
170
|
|
|
156
171
|
private void handleSwitchTab(@NonNull TabBarFragment tabBarFragment, @NonNull ReadableMap extras, @NonNull Callback callback) {
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
172
|
+
int to;
|
|
173
|
+
if (extras.hasKey("tabKey") && !extras.isNull("tabKey")) {
|
|
174
|
+
String tabKey = extras.getString("tabKey");
|
|
175
|
+
to = tabBarFragment.findIndexByTabKey(tabKey);
|
|
176
|
+
if (to < 0) {
|
|
177
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_SCENE_NOT_FOUND, "Can't find tab for key: " + tabKey));
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
if (!extras.hasKey("to") || extras.isNull("to")) {
|
|
182
|
+
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Tab index or tabKey is required for switchTab."));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
to = extras.getInt("to");
|
|
160
186
|
}
|
|
161
|
-
int to = extras.getInt("to");
|
|
162
187
|
int tabCount = tabBarFragment.getChildAwesomeFragments().size();
|
|
163
188
|
if (to < 0 || to >= tabCount) {
|
|
164
189
|
callback.invoke(DispatchResult.fail(DispatchResult.CODE_INVALID_ACTION, "Tab index out of bounds: " + to));
|
package/dist/NativeEvent.d.ts
CHANGED
|
@@ -3,6 +3,9 @@ export type SceneStateChangeEvent = {
|
|
|
3
3
|
sceneId: string;
|
|
4
4
|
state: string;
|
|
5
5
|
prevState: string;
|
|
6
|
+
moduleName?: string;
|
|
7
|
+
mode?: string;
|
|
8
|
+
presentingId?: string;
|
|
6
9
|
};
|
|
7
10
|
export type ResultEvent = {
|
|
8
11
|
sceneId: string;
|
|
@@ -10,11 +13,23 @@ export type ResultEvent = {
|
|
|
10
13
|
resultCode: number;
|
|
11
14
|
resultData: {};
|
|
12
15
|
};
|
|
16
|
+
export type BeforeRemoveRequestEvent = {
|
|
17
|
+
sceneId: string;
|
|
18
|
+
action: string;
|
|
19
|
+
};
|
|
20
|
+
export type TabPressEventWire = {
|
|
21
|
+
index: number;
|
|
22
|
+
tabKey?: string;
|
|
23
|
+
previousIndex: number;
|
|
24
|
+
reselected: boolean;
|
|
25
|
+
};
|
|
13
26
|
export interface Spec extends TurboModule {
|
|
14
27
|
readonly onResult: CodegenTypes.EventEmitter<ResultEvent>;
|
|
15
28
|
readonly willSetRoot: CodegenTypes.EventEmitter<void>;
|
|
16
29
|
readonly didSetRoot: CodegenTypes.EventEmitter<void>;
|
|
17
30
|
readonly onSceneStateChange: CodegenTypes.EventEmitter<SceneStateChangeEvent>;
|
|
31
|
+
readonly onBeforeRemoveRequest: CodegenTypes.EventEmitter<BeforeRemoveRequestEvent>;
|
|
32
|
+
readonly onTabPress: CodegenTypes.EventEmitter<TabPressEventWire>;
|
|
18
33
|
}
|
|
19
34
|
declare const _default: Spec;
|
|
20
35
|
export default _default;
|
|
@@ -4,6 +4,7 @@ export interface DispatchResultWire {
|
|
|
4
4
|
ok: boolean;
|
|
5
5
|
code: string;
|
|
6
6
|
message?: string;
|
|
7
|
+
sceneId?: string;
|
|
7
8
|
}
|
|
8
9
|
export interface Route {
|
|
9
10
|
sceneId: string;
|
|
@@ -18,6 +19,11 @@ export interface RouteGraph {
|
|
|
18
19
|
mode: LayoutMode;
|
|
19
20
|
children?: RouteGraph[];
|
|
20
21
|
}
|
|
22
|
+
export interface NavigationSnapshot {
|
|
23
|
+
rootGeneration: number;
|
|
24
|
+
currentRoute: Route | null;
|
|
25
|
+
layers: RouteGraph[];
|
|
26
|
+
}
|
|
21
27
|
export interface Spec extends TurboModule {
|
|
22
28
|
getConstants: () => {
|
|
23
29
|
RESULT_OK: number;
|
|
@@ -36,8 +42,10 @@ export interface Spec extends TurboModule {
|
|
|
36
42
|
findSceneIdByModuleName: (moduleName: string) => Promise<string | null>;
|
|
37
43
|
currentRoute: () => Promise<Route | null>;
|
|
38
44
|
routeGraph: () => Promise<RouteGraph[]>;
|
|
45
|
+
navigationSnapshot: () => Promise<NavigationSnapshot>;
|
|
39
46
|
setDefaultOptions: (options: CodegenTypes.UnsafeObject) => void;
|
|
40
47
|
updateOptions: (sceneId: string, options: CodegenTypes.UnsafeObject) => void;
|
|
48
|
+
setBeforeRemoveEnabled: (sceneId: string, enabled: boolean) => void;
|
|
41
49
|
updateTabBar: (sceneId: string, item: CodegenTypes.UnsafeObject) => void;
|
|
42
50
|
setTabItem: (sceneId: string, items: Array<CodegenTypes.UnsafeObject>) => void;
|
|
43
51
|
}
|
package/dist/Navigation.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
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, DispatchResult, Layout, NavigationResult, ResultMap, Route, RouteConfig, RouteGraph, RouteName, SceneLifecycleState, SetRootOptions } from './Route';
|
|
4
|
+
import type { BeforeRemoveListener, BeforeRemoveOptions, BuildInLayout, CloseSelfOptions, DispatchResult, Layout, NavigationResult, NavigationSnapshot, ResultMap, Route, RouteConfig, RouteGraph, RouteName, SceneExitHandler, SceneInfo, SceneLifecycleState, SetRootOptions, TabPressListener } from './Route';
|
|
5
5
|
import { RootLayoutListener } from './handler/LayoutCommandHandler';
|
|
6
|
+
import { type RevealOptions, type RevealResult, type RevealTarget } from './reveal';
|
|
7
|
+
import type { RouteDefinition } from './defineRoutes';
|
|
6
8
|
import { RESULT_BLOCK, RESULT_CANCEL, RESULT_OK } from './handler/ResultEventHandler';
|
|
7
9
|
import { GlobalSceneLifecycleListener, GlobalVisibilityEventListener, SceneLifecycleListener, VisibilityEventListener } from './handler/LifecycleEventHandler';
|
|
8
10
|
export type { ResultType } from './handler/ResultEventHandler';
|
|
@@ -19,13 +21,21 @@ export interface Navigation {
|
|
|
19
21
|
startRegisterComponent(hoc?: HOC): void;
|
|
20
22
|
endRegisterComponent(): void;
|
|
21
23
|
registerComponent<Name extends RouteName = RouteName>(appKey: Name, getComponentFunc: ComponentProvider, routeConfig?: RouteConfig): void;
|
|
24
|
+
registerRoutes(routes: readonly RouteDefinition<any, any, any>[]): void;
|
|
25
|
+
preloadRoute(moduleName: RouteName): void;
|
|
22
26
|
addLifecycleListener(sceneId: string, listener: SceneLifecycleListener): NavigationSubscription;
|
|
23
27
|
addGlobalLifecycleListener(listener: GlobalSceneLifecycleListener): NavigationSubscription;
|
|
24
28
|
getSceneState(sceneId: string): SceneLifecycleState;
|
|
29
|
+
getSceneInfo(sceneId: string): SceneInfo | undefined;
|
|
25
30
|
addGlobalVisibilityEventListener(listener: GlobalVisibilityEventListener): NavigationSubscription;
|
|
26
31
|
addVisibilityEventListener(sceneId: string, listener: VisibilityEventListener): NavigationSubscription;
|
|
32
|
+
addTabPressListener(listener: TabPressListener): NavigationSubscription;
|
|
27
33
|
dispatch(sceneId: string, action: string, params?: DispatchParams): Promise<DispatchResult>;
|
|
28
34
|
addInterceptor(interceptor: NavigationInterceptor): NavigationSubscription;
|
|
35
|
+
registerSceneExitHandler(sceneId: string, handler: SceneExitHandler): NavigationSubscription;
|
|
36
|
+
addBeforeRemoveListener(sceneId: string, listener: BeforeRemoveListener, options?: BeforeRemoveOptions): NavigationSubscription;
|
|
37
|
+
closeScene<T extends ResultMap = ResultMap>(sceneId: string, options?: CloseSelfOptions<T>): Promise<DispatchResult>;
|
|
38
|
+
reveal(target: RevealTarget, options?: RevealOptions): Promise<RevealResult>;
|
|
29
39
|
setResult<T extends ResultMap = ResultMap>(sceneId: string, resultCode: number, data?: T | null): void;
|
|
30
40
|
result<T = unknown>(sceneId: string, requestCode: number): Promise<NavigationResult<T>>;
|
|
31
41
|
setRoot(layout: BuildInLayout | Layout, options?: SetRootOptions): Promise<DispatchResult>;
|
|
@@ -35,9 +45,12 @@ export interface Navigation {
|
|
|
35
45
|
isStackRoot(sceneId: string): Promise<boolean>;
|
|
36
46
|
currentRoute(): Promise<Route | null>;
|
|
37
47
|
routeGraph(): Promise<RouteGraph[]>;
|
|
48
|
+
navigationSnapshot(): Promise<NavigationSnapshot>;
|
|
38
49
|
setDefaultOptions(options: DefaultOptions): void;
|
|
39
50
|
updateOptions(sceneId: string, options: NavigationOption): void;
|
|
51
|
+
updateTabBar(options: TabBarStyle): void;
|
|
40
52
|
updateTabBar(sceneId: string, options: TabBarStyle): void;
|
|
53
|
+
setTabItem(item: TabItemInfo | TabItemInfo[]): void;
|
|
41
54
|
setTabItem(sceneId: string, item: TabItemInfo | TabItemInfo[]): void;
|
|
42
55
|
setMenuInteractive(sceneId: string, enabled: boolean): Promise<DispatchResult>;
|
|
43
56
|
}
|