hybrid-navigation 2.18.1 → 2.18.2

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.
@@ -20,6 +20,7 @@ import com.navigation.androidx.AwesomeFragment;
20
20
  import com.navigation.androidx.AwesomeToolbar;
21
21
  import com.navigation.androidx.BarStyle;
22
22
  import com.navigation.androidx.FragmentHelper;
23
+ import com.navigation.androidx.PresentableActivity;
23
24
  import com.navigation.androidx.PresentationStyle;
24
25
  import com.navigation.androidx.Style;
25
26
  import com.navigation.androidx.SystemUI;
@@ -309,5 +310,10 @@ public class HybridFragment extends AwesomeFragment {
309
310
  Bundle args = FragmentHelper.getArguments(this);
310
311
  return args.getString(ARG_MODULE_NAME);
311
312
  }
312
-
313
+
314
+ public String getPresentingSceneId() {
315
+ Bundle args = FragmentHelper.getArguments(this);
316
+ return args.getString(PresentableActivity.ARG_PRESENTING_SCENE_ID);
317
+ }
318
+
313
319
  }
@@ -300,6 +300,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
300
300
  bundle.putString("moduleName", current.getModuleName());
301
301
  bundle.putString("sceneId", current.getSceneId());
302
302
  bundle.putString("mode", Navigator.Util.getMode(current));
303
+ bundle.putString("presentingId", current.getPresentingSceneId());
303
304
  bundle.putInt("requestCode", current.getRequestCode());
304
305
  callback.invoke(null, Arguments.fromBundle(bundle));
305
306
  });
@@ -323,7 +324,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
323
324
  activity.scheduleTaskAtStarted(() -> {
324
325
  FragmentManager fragmentManager = activity.getSupportFragmentManager();
325
326
  ArrayList<Bundle> graph = bridgeManager.buildRouteGraph(fragmentManager);
326
- if (graph.size() == 0) {
327
+ if (graph.isEmpty()) {
327
328
  UiThreadUtil.runOnUiThread(this, 16);
328
329
  return;
329
330
  }
@@ -10,6 +10,7 @@ import com.facebook.react.bridge.Callback;
10
10
  import com.facebook.react.bridge.ReadableMap;
11
11
  import com.navigation.androidx.AwesomeFragment;
12
12
  import com.navigation.androidx.FragmentHelper;
13
+ import com.navigation.androidx.PresentableActivity;
13
14
  import com.navigation.androidx.PresentationStyle;
14
15
  import com.navigation.androidx.TransitionAnimation;
15
16
  import com.reactnative.hybridnavigation.HybridFragment;
@@ -161,9 +162,13 @@ public class ScreenNavigator implements Navigator {
161
162
  callback.invoke(null, false);
162
163
  return;
163
164
  }
165
+
166
+ Bundle args = FragmentHelper.getArguments(presented);
167
+ args.putString(PresentableActivity.ARG_PRESENTING_SCENE_ID, presenting.getSceneId());
168
+ presented.setArguments(args);
164
169
  presented.setPresentationStyle(PresentationStyle.OverFullScreen);
170
+
165
171
  int requestCode = extras.getInt("requestCode");
166
-
167
172
  presenting.presentFragment(presented, requestCode, () -> callback.invoke(null, true), TransitionAnimation.None);
168
173
  }
169
174
 
@@ -187,6 +192,11 @@ public class ScreenNavigator implements Navigator {
187
192
  callback.invoke(null, false);
188
193
  return;
189
194
  }
195
+
196
+ Bundle args = FragmentHelper.getArguments(presented);
197
+ args.putString(PresentableActivity.ARG_PRESENTING_SCENE_ID, presenting.getSceneId());
198
+ presented.setArguments(args);
199
+
190
200
  int requestCode = extras.getInt("requestCode");
191
201
  ReactStackFragment stackFragment = new ReactStackFragment();
192
202
  stackFragment.setRootFragment(presented);
@@ -93,6 +93,9 @@
93
93
  HBDNavigationController *nav = [[HBDNavigationController alloc] initWithRootViewController:vc];
94
94
  nav.modalPresentationStyle = UIModalPresentationCurrentContext;
95
95
  [nav setRequestCode:requestCode];
96
+ [vc setRequestCode:requestCode];
97
+ [vc setPresentingSceneId:presenting.sceneId];
98
+
96
99
  [[HBDAnimationObserver sharedObserver] beginAnimation];
97
100
  [presenting presentViewController:nav animated:YES completion:^{
98
101
  callback(@[NSNull.null, @YES]);
@@ -116,6 +119,7 @@
116
119
  vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
117
120
  vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
118
121
  [vc setRequestCode:requestCode];
122
+
119
123
  [[HBDAnimationObserver sharedObserver] beginAnimation];
120
124
  [presenting presentViewController:vc animated:YES completion:^{
121
125
  callback(@[NSNull.null, @YES]);
@@ -219,6 +219,7 @@ RCT_EXPORT_METHOD(currentRoute:(RCTResponseSenderBlock)callback) {
219
219
  callback(@[[NSNull null], @{
220
220
  @"moduleName": RCTNullIfNil(current.moduleName),
221
221
  @"sceneId": current.sceneId,
222
+ @"presentingId": RCTNullIfNil(current.presentingSceneId),
222
223
  @"mode": [current hbd_mode],
223
224
  @"requestCode": @(current.requestCode),
224
225
  }]);
package/lib/Route.d.ts CHANGED
@@ -42,6 +42,7 @@ export interface Route {
42
42
  sceneId: string;
43
43
  moduleName: string;
44
44
  mode: LayoutMode;
45
+ presentingId: string | null;
45
46
  requestCode: number;
46
47
  }
47
48
  export interface RouteGraph {
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.18.1",
4
+ "version": "2.18.2",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
7
7
  "react-native": "src/index",
package/src/Route.ts CHANGED
@@ -50,6 +50,7 @@ export interface Route {
50
50
  sceneId: string
51
51
  moduleName: string
52
52
  mode: LayoutMode
53
+ presentingId: string | null
53
54
  requestCode: number
54
55
  }
55
56