hybrid-navigation 2.18.11 → 2.18.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.
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivityDelegate.java +4 -3
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +271 -259
- package/dist/Navigator.js +1 -0
- package/ios/HybridNavigation/ViewController/HBDViewController.m +23 -2
- package/package.json +1 -1
- package/src/Navigator.ts +1 -0
package/android/build.gradle
CHANGED
|
@@ -33,5 +33,5 @@ dependencies {
|
|
|
33
33
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
34
34
|
implementation 'com.facebook.react:react-native:+'
|
|
35
35
|
// api project(':navigation')
|
|
36
|
-
api 'io.github.listenzz:AndroidNavigation:13.8.
|
|
36
|
+
api 'io.github.listenzz:AndroidNavigation:13.8.4'
|
|
37
37
|
}
|
package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivityDelegate.java
CHANGED
|
@@ -21,6 +21,7 @@ import com.facebook.infer.annotation.Assertions;
|
|
|
21
21
|
import com.facebook.react.ReactInstanceManager;
|
|
22
22
|
import com.facebook.react.bridge.Callback;
|
|
23
23
|
import com.facebook.react.bridge.ReactContext;
|
|
24
|
+
import com.facebook.react.bridge.UiThreadUtil;
|
|
24
25
|
import com.facebook.react.common.ReactConstants;
|
|
25
26
|
import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
|
|
26
27
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
@@ -69,11 +70,11 @@ public class ReactAppCompatActivityDelegate {
|
|
|
69
70
|
protected ReactBridgeManager getReactBridgeManager() {
|
|
70
71
|
return mBridgeManager;
|
|
71
72
|
}
|
|
72
|
-
|
|
73
|
+
|
|
73
74
|
public ReactInstanceManager getReactInstanceManager() {
|
|
74
75
|
return mBridgeManager.getReactInstanceManager();
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
|
|
77
78
|
public ReactContext getCurrentReactContext() {
|
|
78
79
|
return mBridgeManager.getCurrentReactContext();
|
|
79
80
|
}
|
|
@@ -92,7 +93,7 @@ public class ReactAppCompatActivityDelegate {
|
|
|
92
93
|
protected void onPause() {
|
|
93
94
|
ReactInstanceManager reactInstanceManager = mBridgeManager.getReactInstanceManager();
|
|
94
95
|
ReactContext reactContext = mBridgeManager.getCurrentReactContext();
|
|
95
|
-
if (reactContext != null && reactInstanceManager != null) {
|
|
96
|
+
if (reactContext != null && reactInstanceManager != null && UiThreadUtil.isOnUiThread()) {
|
|
96
97
|
reactInstanceManager.onHostPause(getPlainActivity());
|
|
97
98
|
}
|
|
98
99
|
}
|
|
@@ -35,263 +35,275 @@ import com.navigation.androidx.Style;
|
|
|
35
35
|
|
|
36
36
|
public class ReactFragment extends HybridFragment implements ReactBridgeManager.ReactBridgeReloadListener {
|
|
37
37
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
38
|
+
protected static final String TAG = "Navigation";
|
|
39
|
+
|
|
40
|
+
private ViewGroup reactViewHolder;
|
|
41
|
+
|
|
42
|
+
private HBDReactRootView reactRootView;
|
|
43
|
+
private HBDReactRootView reactTitleView;
|
|
44
|
+
private boolean firstRenderCompleted;
|
|
45
|
+
|
|
46
|
+
@Nullable
|
|
47
|
+
@Override
|
|
48
|
+
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
|
49
|
+
View view = inflater.inflate(R.layout.nav_fragment_react, container, false);
|
|
50
|
+
reactViewHolder = view.findViewById(R.id.react_content);
|
|
51
|
+
if (isReactModuleRegisterCompleted()) {
|
|
52
|
+
mountReactView();
|
|
53
|
+
}
|
|
54
|
+
return view;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Override
|
|
58
|
+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
59
|
+
super.onViewCreated(view, savedInstanceState);
|
|
60
|
+
// 这个时候 toolbar 才创建好
|
|
61
|
+
initReactTitleView();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@Override
|
|
65
|
+
protected boolean extendedLayoutIncludesToolbar() {
|
|
66
|
+
int color = mStyle.getToolbarBackgroundColor();
|
|
67
|
+
float alpha = mStyle.getToolbarAlpha();
|
|
68
|
+
Garden garden = getGarden();
|
|
69
|
+
return Color.alpha(color) < 255 || alpha < 1.0 || garden.toolbarHidden || garden.extendedLayoutIncludesTopBar;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@Override
|
|
73
|
+
protected void onCustomStyle(@NonNull Style style) {
|
|
74
|
+
super.onCustomStyle(style);
|
|
75
|
+
if (shouldPassThroughTouches()) {
|
|
76
|
+
style.setScrimAlpha(0);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@SuppressLint("SourceLockedOrientationActivity")
|
|
81
|
+
@Override
|
|
82
|
+
public void onResume() {
|
|
83
|
+
super.onResume();
|
|
84
|
+
if (isViewReady()) {
|
|
85
|
+
sendViewAppearEvent(true);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!forceScreenLandscape() &&
|
|
89
|
+
!Navigator.MODE_MODAL.equals(Navigator.Util.getMode(this)) &&
|
|
90
|
+
requireActivity().getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) {
|
|
91
|
+
requireView().clearAnimation();
|
|
92
|
+
requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (forceScreenLandscape()) {
|
|
96
|
+
requireView().clearAnimation();
|
|
97
|
+
requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Override
|
|
102
|
+
public void onPause() {
|
|
103
|
+
super.onPause();
|
|
104
|
+
if (isViewReady()) {
|
|
105
|
+
sendViewAppearEvent(false);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@Override
|
|
110
|
+
public void onStart() {
|
|
111
|
+
super.onStart();
|
|
112
|
+
if (forceScreenLandscape()) {
|
|
113
|
+
requireView().clearAnimation();
|
|
114
|
+
requireActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@SuppressLint("SourceLockedOrientationActivity")
|
|
119
|
+
@Override
|
|
120
|
+
public void onStop() {
|
|
121
|
+
if (isRemoving() && forceScreenLandscape()) {
|
|
122
|
+
Activity activity = requireActivity();
|
|
123
|
+
activity.getWindow().getDecorView().postDelayed(() ->
|
|
124
|
+
activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT), 16);
|
|
125
|
+
}
|
|
126
|
+
super.onStop();
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
private boolean isViewReady() {
|
|
130
|
+
if (reactRootView == null) {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
return firstRenderCompleted;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private boolean reactViewAppeared = false;
|
|
137
|
+
|
|
138
|
+
private void sendViewAppearEvent(boolean appear) {
|
|
139
|
+
if (!isReactModuleRegisterCompleted()) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// 当从前台进入后台时,不会触发 disappear, 这和 iOS 保持一致
|
|
144
|
+
ReactContext reactContext = getCurrentReactContext();
|
|
145
|
+
boolean isResumed = reactContext != null && reactContext.getLifecycleState() == LifecycleState.RESUMED;
|
|
146
|
+
if (!isResumed) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
if (reactViewAppeared == appear) {
|
|
151
|
+
return;
|
|
152
|
+
}
|
|
153
|
+
reactViewAppeared = appear;
|
|
154
|
+
|
|
155
|
+
Bundle bundle = new Bundle();
|
|
156
|
+
bundle.putString(KEY_SCENE_ID, getSceneId());
|
|
157
|
+
bundle.putString(KEY_ON, appear ? ON_COMPONENT_APPEAR : ON_COMPONENT_DISAPPEAR);
|
|
158
|
+
HBDEventEmitter.sendEvent(EVENT_NAVIGATION, Arguments.fromBundle(bundle));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@Override
|
|
162
|
+
public void onDestroyView() {
|
|
163
|
+
super.onDestroyView();
|
|
164
|
+
unmountReactView();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
@Override
|
|
168
|
+
public void onReload() {
|
|
169
|
+
unmountReactView();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private void mountReactView() {
|
|
173
|
+
initReactRootView();
|
|
174
|
+
getReactBridgeManager().addReactBridgeReloadListener(this);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
private void unmountReactView() {
|
|
178
|
+
getReactBridgeManager().removeReactBridgeReloadListener(this);
|
|
179
|
+
|
|
180
|
+
ReactContext reactContext = getCurrentReactContext();
|
|
181
|
+
if (reactContext == null || !reactContext.hasActiveCatalystInstance()) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (reactRootView != null) {
|
|
186
|
+
FLog.w(TAG, "销毁页面-:" + getModuleName());
|
|
187
|
+
reactRootView.unmountReactApplication();
|
|
188
|
+
ViewGroup parent = (ViewGroup) reactRootView.getParent();
|
|
189
|
+
parent.removeView(reactRootView);
|
|
190
|
+
reactRootView = null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
if (reactTitleView != null) {
|
|
194
|
+
reactTitleView.unmountReactApplication();
|
|
195
|
+
ViewGroup parent = (ViewGroup) reactTitleView.getParent();
|
|
196
|
+
parent.removeView(reactTitleView);
|
|
197
|
+
reactTitleView = null;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
@Override
|
|
202
|
+
protected boolean onBackPressed() {
|
|
203
|
+
ReactInstanceManager reactInstanceManager = getReactInstanceManager();
|
|
204
|
+
if (getShowsDialog() && reactInstanceManager != null) {
|
|
205
|
+
reactInstanceManager.onBackPressed();
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return super.onBackPressed();
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
public void signalFirstRenderComplete() {
|
|
212
|
+
if (firstRenderCompleted) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
firstRenderCompleted = true;
|
|
216
|
+
|
|
217
|
+
if (isViewReady() && isResumed()) {
|
|
218
|
+
sendViewAppearEvent(true);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
public boolean isFirstRenderCompleted() {
|
|
223
|
+
return firstRenderCompleted;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@Override
|
|
227
|
+
public void onFragmentResult(int requestCode, int resultCode, Bundle data) {
|
|
228
|
+
super.onFragmentResult(requestCode, resultCode, data);
|
|
229
|
+
Bundle result = new Bundle();
|
|
230
|
+
result.putInt(KEY_REQUEST_CODE, requestCode);
|
|
231
|
+
result.putInt(KEY_RESULT_CODE, resultCode);
|
|
232
|
+
result.putBundle(KEY_RESULT_DATA, data);
|
|
233
|
+
result.putString(KEY_SCENE_ID, getSceneId());
|
|
234
|
+
result.putString(KEY_ON, ON_COMPONENT_RESULT);
|
|
235
|
+
HBDEventEmitter.sendEvent(EVENT_NAVIGATION, Arguments.fromBundle(result));
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
@Override
|
|
239
|
+
public void setAppProperties(@NonNull Bundle props) {
|
|
240
|
+
super.setAppProperties(props);
|
|
241
|
+
if (reactRootView == null) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (isReactModuleRegisterCompleted()) {
|
|
246
|
+
reactRootView.setAppProperties(getProps());
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
private void initReactRootView() {
|
|
251
|
+
reactRootView = createReactRootView();
|
|
252
|
+
reactRootView.startReactApplication(getReactInstanceManager(), getModuleName(), getProps());
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
@NonNull
|
|
256
|
+
private HBDReactRootView createReactRootView() {
|
|
257
|
+
HBDReactRootView reactRootView = new HBDReactRootView(getContext());
|
|
258
|
+
reactRootView.setShouldConsumeTouchEvent(!shouldPassThroughTouches());
|
|
259
|
+
ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT);
|
|
260
|
+
reactViewHolder.addView(reactRootView, layoutParams);
|
|
261
|
+
return reactRootView;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
private void initReactTitleView() {
|
|
265
|
+
if (getToolbar() == null) {
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
Bundle titleItem = getOptions().getBundle("titleItem");
|
|
270
|
+
if (titleItem == null) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
String moduleName = titleItem.getString("moduleName");
|
|
275
|
+
if (moduleName == null) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (!isReactModuleRegisterCompleted()) {
|
|
280
|
+
throw new IllegalStateException("[Navigation] React Component 还没有注册完毕。");
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
String fitting = titleItem.getString("layoutFitting");
|
|
284
|
+
boolean expanded = "expanded".equals(fitting);
|
|
285
|
+
reactTitleView = createReactTitleView(expanded);
|
|
286
|
+
reactTitleView.startReactApplication(getReactInstanceManager(), moduleName, getProps());
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
private HBDReactRootView createReactTitleView(boolean expanded) {
|
|
290
|
+
Toolbar.LayoutParams layoutParams = createTitleLayoutParams(expanded);
|
|
291
|
+
HBDReactRootView reactTitleView = new HBDReactRootView(getContext());
|
|
292
|
+
Toolbar toolbar = getToolbar();
|
|
293
|
+
toolbar.addView(reactTitleView, layoutParams);
|
|
294
|
+
return reactTitleView;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
@NonNull
|
|
298
|
+
private Toolbar.LayoutParams createTitleLayoutParams(boolean expanded) {
|
|
299
|
+
if (expanded) {
|
|
300
|
+
return new Toolbar.LayoutParams(MATCH_PARENT, MATCH_PARENT, Gravity.CENTER);
|
|
301
|
+
}
|
|
302
|
+
return new Toolbar.LayoutParams(WRAP_CONTENT, WRAP_CONTENT, Gravity.CENTER);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
@Override
|
|
306
|
+
public String getDebugTag() {
|
|
307
|
+
return "[" + getModuleName() + "]";
|
|
308
|
+
}
|
|
297
309
|
}
|
package/dist/Navigator.js
CHANGED
|
@@ -77,6 +77,7 @@ class Navigator {
|
|
|
77
77
|
moduleName,
|
|
78
78
|
inclusive,
|
|
79
79
|
from: this.moduleName,
|
|
80
|
+
to: moduleName,
|
|
80
81
|
});
|
|
81
82
|
popToRoot = () => Navigation.dispatch(this.sceneId, 'popToRoot', { from: this.moduleName });
|
|
82
83
|
redirectTo = (moduleName, props = {}, options = {}) => Navigation.dispatch(this.sceneId, 'redirectTo', {
|
|
@@ -96,12 +96,21 @@
|
|
|
96
96
|
return NO;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
- (void)viewWillAppear:(BOOL)animated {
|
|
100
|
+
[super viewWillAppear:animated];
|
|
101
|
+
if (!self.navigationController.transitionCoordinator.interactive) {
|
|
102
|
+
[self adjustScreenOrientation];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
99
106
|
- (void)viewDidAppear:(BOOL)animated {
|
|
100
107
|
[super viewDidAppear:animated];
|
|
101
108
|
[[HBDAnimationObserver sharedObserver] endAnimation];
|
|
102
109
|
if (![HBDUtils isIphoneX]) {
|
|
103
110
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarFrameWillChange:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil];
|
|
104
111
|
}
|
|
112
|
+
|
|
113
|
+
[self adjustScreenOrientation];
|
|
105
114
|
}
|
|
106
115
|
|
|
107
116
|
- (void)viewDidDisappear:(BOOL)animated {
|
|
@@ -111,6 +120,19 @@
|
|
|
111
120
|
}
|
|
112
121
|
}
|
|
113
122
|
|
|
123
|
+
- (void)adjustScreenOrientation {
|
|
124
|
+
if (@available(iOS 15.0, *)) {
|
|
125
|
+
UIWindowScene *windowScene = [self getWindowScene];
|
|
126
|
+
if (!self.forceScreenLandscape && windowScene != nil && windowScene.interfaceOrientation != UIInterfaceOrientationPortrait && ![[self hbd_mode] isEqual:@"modal"]) {
|
|
127
|
+
[self setScreenOrientation:UIInterfaceOrientationPortrait usingMask:UIInterfaceOrientationMaskPortrait];
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (self.forceScreenLandscape) {
|
|
131
|
+
[self setScreenOrientation:UIInterfaceOrientationLandscapeRight usingMask:UIInterfaceOrientationMaskLandscape];
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
114
136
|
- (void)willMoveToParentViewController:(UIViewController *)parent {
|
|
115
137
|
if (self.forceScreenLandscape) {
|
|
116
138
|
if (parent) {
|
|
@@ -123,7 +145,6 @@
|
|
|
123
145
|
|
|
124
146
|
- (void)setScreenOrientation:(UIInterfaceOrientation) orientation usingMask:(UIInterfaceOrientationMask) mask {
|
|
125
147
|
[GlobalStyle globalStyle].interfaceOrientation = mask;
|
|
126
|
-
|
|
127
148
|
if (@available(iOS 16.0, *)) {
|
|
128
149
|
UIWindowScene *windowScene = [self getWindowScene];
|
|
129
150
|
if (windowScene != nil) {
|
|
@@ -145,7 +166,7 @@
|
|
|
145
166
|
[UIViewController attemptRotationToDeviceOrientation];
|
|
146
167
|
}
|
|
147
168
|
|
|
148
|
-
- (UIWindowScene *)getWindowScene
|
|
169
|
+
- (UIWindowScene *)getWindowScene API_AVAILABLE(ios(13.0)){
|
|
149
170
|
NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
|
|
150
171
|
for (id connectedScene in array) {
|
|
151
172
|
if ([connectedScene isKindOfClass:[UIWindowScene class]]) {
|
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.
|
|
4
|
+
"version": "2.18.13",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"typings": "./dist/index.d.ts",
|
|
7
7
|
"react-native": "src/index",
|
package/src/Navigator.ts
CHANGED