hybrid-navigation 2.13.12 → 2.13.13

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.
@@ -127,19 +127,27 @@ public class NavigationModule extends ReactContextBaseJavaModule {
127
127
  @ReactMethod
128
128
  public void dispatch(final String sceneId, final String action, final ReadableMap extras, Callback callback) {
129
129
  UiThreadUtil.runOnUiThread(() -> {
130
- AwesomeFragment target = findFragmentBySceneId(sceneId);
131
- if (target == null) {
130
+ AwesomeActivity activity = getActiveActivity();
131
+ if (activity == null) {
132
132
  callback.invoke(null, false);
133
- FLog.w(TAG, "Can't find target scene for action:" + action + ", maybe the scene is gone.\nextras: " + extras);
134
133
  return;
135
134
  }
135
+
136
+ activity.scheduleTaskAtStarted(() -> {
137
+ AwesomeFragment target = findFragmentBySceneId(sceneId);
138
+ if (target == null) {
139
+ callback.invoke(null, false);
140
+ FLog.w(TAG, "Can't find target scene for action:" + action + ", maybe the scene is gone.\nextras: " + extras);
141
+ return;
142
+ }
136
143
 
137
- if (!target.isAdded() || target.isRemoving()) {
138
- callback.invoke(null, false);
139
- return;
140
- }
144
+ if (!target.isAdded() || target.isRemoving()) {
145
+ callback.invoke(null, false);
146
+ return;
147
+ }
141
148
 
142
- bridgeManager.handleNavigation(target, action, extras, callback);
149
+ bridgeManager.handleNavigation(target, action, extras, callback);
150
+ });
143
151
  });
144
152
  }
145
153
 
@@ -194,7 +202,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
194
202
  UiThreadUtil.runOnUiThread(this, 16);
195
203
  return;
196
204
  }
197
-
205
+
198
206
  FragmentManager fragmentManager = activity.getSupportFragmentManager();
199
207
  Fragment fragment = fragmentManager.findFragmentById(android.R.id.content);
200
208
  if (!(fragment instanceof AwesomeFragment)) {
@@ -254,7 +262,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
254
262
  UiThreadUtil.runOnUiThread(this, 16);
255
263
  return;
256
264
  }
257
-
265
+
258
266
  FragmentManager fragmentManager = activity.getSupportFragmentManager();
259
267
  HybridFragment current = bridgeManager.primaryFragment(fragmentManager);
260
268
  if (current == null) {
@@ -283,7 +291,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
283
291
  UiThreadUtil.runOnUiThread(this, 16);
284
292
  return;
285
293
  }
286
-
294
+
287
295
  FragmentManager fragmentManager = activity.getSupportFragmentManager();
288
296
  ArrayList<Bundle> graph = bridgeManager.buildRouteGraph(fragmentManager);
289
297
  if (graph.size() == 0) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hybrid-navigation",
3
3
  "description": "React Native Navigation that supports seamless navigation between Native and React.",
4
- "version": "2.13.12",
4
+ "version": "2.13.13",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
7
7
  "react-native": "src/index",