hybrid-navigation 2.20.1 → 3.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 +7 -5
- package/README.md +17 -0
- package/android/build.gradle +56 -19
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +1 -2
- package/android/src/main/java/com/reactnative/hybridnavigation/Garden.java +320 -326
- package/android/src/main/java/com/reactnative/hybridnavigation/GlobalStyle.java +13 -20
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridFragment.java +6 -11
- package/android/src/main/java/com/reactnative/hybridnavigation/HybridNavigationPackage.java +55 -21
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeEvent.java +31 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeGarden.java +223 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/NativeNavigation.java +370 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivity.java +239 -224
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactAppCompatActivityDelegate.java +177 -198
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactDrawerFragment.java +2 -9
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactFragment.java +41 -78
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactManager.java +438 -0
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactStackFragment.java +10 -19
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBar.java +7 -15
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarFragment.java +135 -173
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactTabBarProvider.java +54 -227
- package/android/src/main/java/com/reactnative/hybridnavigation/Utils.java +2 -3
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/DrawerNavigator.java +12 -14
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/ScreenNavigator.java +18 -21
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/StackNavigator.java +17 -20
- package/android/src/main/java/com/reactnative/hybridnavigation/navigator/TabNavigator.java +13 -26
- package/dist/NativeEvent.d.ts +33 -0
- package/dist/NativeEvent.js +2 -0
- package/dist/NativeGarden.d.ts +18 -0
- package/dist/NativeGarden.js +2 -0
- package/dist/NativeNavigation.d.ts +47 -0
- package/dist/NativeNavigation.js +2 -0
- package/dist/Navigation.js +3 -3
- package/dist/NavigationModule.d.ts +3 -3
- package/dist/NavigationModule.js +18 -19
- package/dist/Navigator.js +1 -2
- package/dist/Options.d.ts +4 -7
- package/dist/Route.d.ts +0 -2
- package/dist/handler/BarButtonEventHandler.js +2 -2
- package/dist/handler/LayoutCommandHandler.js +3 -3
- package/dist/handler/ResultEventHandler.js +3 -3
- package/dist/handler/VisibilityEventHandler.js +11 -4
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/ios/HybridNavigation/GlobalStyle.h +0 -6
- package/ios/HybridNavigation/{GlobalStyle.m → GlobalStyle.mm} +54 -44
- package/ios/HybridNavigation/HBDUtils.h +0 -4
- package/ios/HybridNavigation/{HBDUtils.m → HBDUtils.mm} +0 -41
- package/ios/HybridNavigation/Navigator/{HBDScreenNavigator.m → HBDScreenNavigator.mm} +3 -9
- package/ios/HybridNavigation/Navigator/{HBDStackNavigator.m → HBDStackNavigator.mm} +0 -4
- package/ios/HybridNavigation/Navigator/{HBDTabNavigator.m → HBDTabNavigator.mm} +1 -55
- package/ios/HybridNavigation/React/HBDNativeEvent.h +13 -0
- package/ios/HybridNavigation/React/HBDNativeEvent.mm +31 -0
- package/ios/HybridNavigation/React/HBDNativeGarden.h +10 -0
- package/ios/HybridNavigation/React/HBDNativeGarden.mm +151 -0
- package/ios/HybridNavigation/React/HBDNativeNavigation.h +11 -0
- package/ios/HybridNavigation/React/HBDNativeNavigation.mm +263 -0
- package/ios/HybridNavigation/{ReactBridge → React}/HBDReactBridgeManager.h +3 -1
- package/ios/HybridNavigation/{ReactBridge/HBDReactBridgeManager.m → React/HBDReactBridgeManager.mm} +7 -30
- package/ios/HybridNavigation/View/HBDRootView.h +2 -2
- package/ios/HybridNavigation/View/{HBDRootView.m → HBDRootView.mm} +2 -2
- package/ios/HybridNavigation/View/HBDTitleView.h +2 -2
- package/ios/HybridNavigation/View/{HBDTitleView.m → HBDTitleView.mm} +3 -3
- package/ios/HybridNavigation/View/UIImage+WithBadge.h +13 -0
- package/ios/HybridNavigation/View/UIImage+WithBadge.mm +36 -0
- package/ios/HybridNavigation/ViewController/{HBDDrawerController.m → HBDDrawerController.mm} +2 -25
- package/ios/HybridNavigation/ViewController/HBDReactViewController.h +0 -4
- package/ios/HybridNavigation/ViewController/{HBDReactViewController.m → HBDReactViewController.mm} +40 -31
- package/ios/HybridNavigation/ViewController/HBDTabBarController.h +0 -2
- package/ios/HybridNavigation/ViewController/HBDTabBarController.mm +140 -0
- package/ios/HybridNavigation/ViewController/HBDViewController+Garden.h +0 -2
- package/ios/HybridNavigation/ViewController/{HBDViewController+Garden.m → HBDViewController+Garden.mm} +8 -26
- package/ios/HybridNavigation/ViewController/HBDViewController.h +2 -0
- package/ios/HybridNavigation/ViewController/{HBDViewController.m → HBDViewController.mm} +67 -57
- package/ios/HybridNavigation/ViewController/UIViewController+HBD.h +0 -2
- package/ios/HybridNavigation/ViewController/{UIViewController+HBD.m → UIViewController+HBD.mm} +1 -42
- package/package.json +11 -2
- package/src/DeepLink.ts +3 -3
- package/src/NativeEvent.ts +40 -0
- package/src/NativeGarden.ts +27 -0
- package/src/NativeNavigation.ts +72 -0
- package/src/Navigation.ts +13 -13
- package/src/NavigationComponentWrap.tsx +4 -4
- package/src/NavigationModule.ts +21 -46
- package/src/Navigator.ts +13 -13
- package/src/Options.ts +9 -9
- package/src/Route.ts +0 -2
- package/src/handler/BarButtonEventHandler.ts +4 -8
- package/src/handler/DispatchCommandHandler.ts +4 -8
- package/src/handler/LayoutCommandHandler.ts +4 -5
- package/src/handler/ResultEventHandler.ts +11 -27
- package/src/handler/VisibilityEventHandler.ts +23 -32
- package/src/hooks.ts +2 -2
- package/src/index.ts +4 -5
- package/src/router/drawer.ts +5 -5
- package/src/router/index.ts +15 -15
- package/src/router/screen.ts +2 -2
- package/src/router/stack.ts +4 -4
- package/src/router/tabs.ts +3 -3
- package/src/store.ts +1 -1
- package/android/src/main/java/com/reactnative/hybridnavigation/DefaultTabBarProvider.java +0 -143
- package/android/src/main/java/com/reactnative/hybridnavigation/GardenModule.java +0 -230
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDEventEmitter.java +0 -89
- package/android/src/main/java/com/reactnative/hybridnavigation/HBDReactRootView.java +0 -71
- package/android/src/main/java/com/reactnative/hybridnavigation/NavigationModule.java +0 -370
- package/android/src/main/java/com/reactnative/hybridnavigation/ReactBridgeManager.java +0 -445
- package/dist/Event.d.ts +0 -16
- package/dist/Event.js +0 -62
- package/dist/GardenModule.d.ts +0 -24
- package/dist/GardenModule.js +0 -21
- package/ios/HybridNavigation/HBDAnimationObserver.h +0 -24
- package/ios/HybridNavigation/HBDAnimationObserver.m +0 -45
- package/ios/HybridNavigation/ReactBridge/HBDEventEmitter.h +0 -28
- package/ios/HybridNavigation/ReactBridge/HBDEventEmitter.m +0 -72
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.h +0 -6
- package/ios/HybridNavigation/ReactBridge/HBDGardenModule.m +0 -157
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.h +0 -6
- package/ios/HybridNavigation/ReactBridge/HBDNavigationModule.m +0 -249
- package/ios/HybridNavigation/View/HBDReactTabBar.h +0 -9
- package/ios/HybridNavigation/View/HBDReactTabBar.m +0 -36
- package/ios/HybridNavigation/View/UITabBar+Badge.h +0 -9
- package/ios/HybridNavigation/View/UITabBar+Badge.m +0 -46
- package/ios/HybridNavigation/ViewController/HBDTabBarController.m +0 -265
- package/src/Event.ts +0 -117
- package/src/GardenModule.ts +0 -50
- /package/ios/HybridNavigation/Navigator/{HBDDrawerNavigator.m → HBDDrawerNavigator.mm} +0 -0
- /package/ios/HybridNavigation/Navigator/{HBDNavigatorRegistry.m → HBDNavigatorRegistry.mm} +0 -0
- /package/ios/HybridNavigation/{ReactBridge → React}/HBDNavigator.h +0 -0
- /package/ios/HybridNavigation/View/{HBDBackBarButtonItem.m → HBDBackBarButtonItem.mm} +0 -0
- /package/ios/HybridNavigation/View/{HBDBarButtonItem.m → HBDBarButtonItem.mm} +0 -0
- /package/ios/HybridNavigation/View/{HBDNavigationBar.m → HBDNavigationBar.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDFadeAnimation.m → HBDFadeAnimation.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDNavigationController.m → HBDNavigationController.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDPopAnimation.m → HBDPopAnimation.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{HBDPushAnimation.m → HBDPushAnimation.mm} +0 -0
- /package/ios/HybridNavigation/ViewController/{UINavigationController+HBD.m → UINavigationController+HBD.mm} +0 -0
|
@@ -5,242 +5,257 @@ import android.content.res.Configuration;
|
|
|
5
5
|
import android.os.Bundle;
|
|
6
6
|
import android.view.KeyEvent;
|
|
7
7
|
|
|
8
|
+
import androidx.activity.OnBackPressedCallback;
|
|
8
9
|
import androidx.annotation.NonNull;
|
|
9
10
|
import androidx.fragment.app.Fragment;
|
|
10
11
|
|
|
11
12
|
import com.facebook.common.logging.FLog;
|
|
12
|
-
import com.facebook.react.ReactInstanceManager;
|
|
13
|
-
import com.facebook.react.bridge.Arguments;
|
|
14
13
|
import com.facebook.react.bridge.Callback;
|
|
15
14
|
import com.facebook.react.bridge.ReactContext;
|
|
16
15
|
import com.facebook.react.bridge.ReadableMap;
|
|
17
16
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
18
17
|
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
19
18
|
import com.facebook.react.modules.core.PermissionListener;
|
|
19
|
+
import com.facebook.react.util.AndroidVersion;
|
|
20
20
|
import com.navigation.androidx.AwesomeActivity;
|
|
21
21
|
import com.navigation.androidx.AwesomeFragment;
|
|
22
22
|
import com.navigation.androidx.Style;
|
|
23
23
|
|
|
24
|
-
public class ReactAppCompatActivity extends AwesomeActivity implements DefaultHardwareBackBtnHandler, PermissionAwareActivity,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
24
|
+
public class ReactAppCompatActivity extends AwesomeActivity implements DefaultHardwareBackBtnHandler, PermissionAwareActivity, ReactManager.ReactModuleRegisterListener {
|
|
25
|
+
|
|
26
|
+
protected static final String TAG = "Navigation";
|
|
27
|
+
|
|
28
|
+
private final ReactAppCompatActivityDelegate mDelegate;
|
|
29
|
+
|
|
30
|
+
private final OnBackPressedCallback mBackPressedCallback =
|
|
31
|
+
new OnBackPressedCallback(true) {
|
|
32
|
+
@Override
|
|
33
|
+
public void handleOnBackPressed() {
|
|
34
|
+
setEnabled(false);
|
|
35
|
+
onBackPressed();
|
|
36
|
+
setEnabled(true);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
protected ReactAppCompatActivity() {
|
|
41
|
+
mDelegate = createReactActivityDelegate();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected ReactAppCompatActivityDelegate createReactActivityDelegate() {
|
|
45
|
+
return new ReactAppCompatActivityDelegate(this, ReactManager.get());
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@Override
|
|
49
|
+
protected void onCreate(Bundle savedInstanceState) {
|
|
50
|
+
super.onCreate(savedInstanceState);
|
|
51
|
+
if (savedInstanceState != null) {
|
|
52
|
+
FLog.i(TAG, "ReactAppCompatActivity#re-create");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
mDelegate.onCreate(savedInstanceState);
|
|
56
|
+
if (AndroidVersion.isAtLeastTargetSdk36(this)) {
|
|
57
|
+
getOnBackPressedDispatcher().addCallback(this, mBackPressedCallback);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
ReactManager reactManager = getReactManager();
|
|
61
|
+
reactManager.addReactModuleRegisterListener(this);
|
|
62
|
+
if (isReactModuleRegisterCompleted()) {
|
|
63
|
+
onReactModuleRegisterCompleted();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public void inflateStyle() {
|
|
68
|
+
Style style = getStyle();
|
|
69
|
+
GlobalStyle globalStyle = Garden.getGlobalStyle();
|
|
70
|
+
if (style != null && !isFinishing()) {
|
|
71
|
+
FLog.i(TAG, "ReactAppCompatActivity#inflateStyle");
|
|
72
|
+
globalStyle.inflateStyle(this, style);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
@Override
|
|
77
|
+
protected void onDestroy() {
|
|
78
|
+
getReactManager().removeReactModuleRegisterListener(this);
|
|
79
|
+
super.onDestroy();
|
|
80
|
+
mDelegate.onDestroy();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@Override
|
|
84
|
+
public void onReactModuleRegisterCompleted() {
|
|
85
|
+
FLog.i(TAG, "ReactAppCompatActivity#onReactModuleRegisterCompleted");
|
|
86
|
+
ReactManager reactManager = getReactManager();
|
|
87
|
+
ReactContext reactContext = reactManager.getCurrentReactContext();
|
|
88
|
+
if (isResumed && reactContext != null && reactContext.getCurrentActivity() == null) {
|
|
89
|
+
mDelegate.onResume();
|
|
90
|
+
}
|
|
91
|
+
inflateStyle();
|
|
92
|
+
Fragment fragment = getSupportFragmentManager().findFragmentById(android.R.id.content);
|
|
93
|
+
if (fragment == null) {
|
|
94
|
+
createMainComponent();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private void createMainComponent() {
|
|
99
|
+
onCreateMainComponent();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
protected void onCreateMainComponent() {
|
|
103
|
+
ReactManager reactManager = getReactManager();
|
|
104
|
+
if (getMainComponentName() != null) {
|
|
105
|
+
AwesomeFragment fragment = reactManager.createFragment(getMainComponentName());
|
|
106
|
+
ReactStackFragment stackFragment = new ReactStackFragment();
|
|
107
|
+
stackFragment.setRootFragment(fragment);
|
|
108
|
+
setActivityRootFragment(stackFragment);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (reactManager.hasPendingLayout()) {
|
|
113
|
+
FLog.i(TAG, "Set root Fragment from pending layout when create main component");
|
|
114
|
+
setActivityRootFragment(reactManager.getPendingLayout());
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (reactManager.hasStickyLayout()) {
|
|
119
|
+
FLog.i(TAG, "Set root Fragment from sticky layout when create main component");
|
|
120
|
+
setActivityRootFragment(reactManager.getStickyLayout());
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (reactManager.hasRootLayout()) {
|
|
125
|
+
FLog.i(TAG, "Set root Fragment from last root layout when create main component");
|
|
126
|
+
setActivityRootFragment(reactManager.getRootLayout());
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
FLog.w(TAG, "No layout to set when create main component");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
protected String getMainComponentName() {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
protected void setActivityRootFragment(ReadableMap layout) {
|
|
138
|
+
ReactManager reactManager = getReactManager();
|
|
139
|
+
AwesomeFragment fragment = reactManager.createFragment(layout);
|
|
140
|
+
if (fragment == null) {
|
|
141
|
+
throw new IllegalArgumentException("无法创建 Fragment. " + layout);
|
|
142
|
+
}
|
|
143
|
+
setActivityRootFragment(fragment);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@Override
|
|
147
|
+
protected void setActivityRootFragmentSync(AwesomeFragment fragment) {
|
|
148
|
+
ReactManager reactManager = getReactManager();
|
|
149
|
+
NativeEvent.getInstance().emitWillSetRoot();
|
|
150
|
+
super.setActivityRootFragmentSync(fragment);
|
|
151
|
+
reactManager.setViewHierarchyReady(true);
|
|
152
|
+
Callback callback = reactManager.getPendingCallback();
|
|
153
|
+
if (callback != null) {
|
|
154
|
+
callback.invoke(null, true);
|
|
155
|
+
reactManager.setPendingLayout(null, null);
|
|
156
|
+
}
|
|
157
|
+
NativeEvent.getInstance().emitDidSetRoot();
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
boolean isResumed = false;
|
|
161
|
+
|
|
162
|
+
@Override
|
|
163
|
+
protected void onResume() {
|
|
164
|
+
super.onResume();
|
|
165
|
+
isResumed = true;
|
|
166
|
+
mDelegate.onResume();
|
|
167
|
+
|
|
168
|
+
ReactManager reactManager = getReactManager();
|
|
169
|
+
if (reactManager.hasPendingLayout()) {
|
|
170
|
+
FLog.i(TAG, "Set root Fragment from pending layout when resume.");
|
|
171
|
+
setActivityRootFragment(reactManager.getPendingLayout());
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
@Override
|
|
176
|
+
protected void onPause() {
|
|
177
|
+
isResumed = false;
|
|
178
|
+
mDelegate.onPause();
|
|
179
|
+
super.onPause();
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@Override
|
|
183
|
+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
184
|
+
mDelegate.onActivityResult(requestCode, resultCode, data);
|
|
185
|
+
super.onActivityResult(requestCode, resultCode, data);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@Override
|
|
189
|
+
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
190
|
+
return mDelegate.onKeyDown(keyCode, event) || super.onKeyDown(keyCode, event);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@Override
|
|
194
|
+
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
|
195
|
+
return mDelegate.onKeyUp(keyCode, event) || super.onKeyUp(keyCode, event);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@Override
|
|
199
|
+
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
|
|
200
|
+
return mDelegate.onKeyLongPress(keyCode, event) || super.onKeyLongPress(keyCode, event);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@Override
|
|
204
|
+
public void onBackPressed() {
|
|
205
|
+
if (!mDelegate.onBackPressed()) {
|
|
206
|
+
super.onBackPressed();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
@Override
|
|
211
|
+
public void invokeDefaultOnBackPressed() {
|
|
212
|
+
scheduleTaskAtStarted(ReactAppCompatActivity.super::onBackPressed);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@Override
|
|
216
|
+
public void onNewIntent(Intent intent) {
|
|
217
|
+
if (!mDelegate.onNewIntent(intent)) {
|
|
218
|
+
super.onNewIntent(intent);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@Override
|
|
223
|
+
protected void onUserLeaveHint() {
|
|
224
|
+
super.onUserLeaveHint();
|
|
225
|
+
mDelegate.onUserLeaveHint();
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@Override
|
|
229
|
+
public void requestPermissions(@NonNull String[] permissions, int requestCode, PermissionListener listener) {
|
|
230
|
+
mDelegate.requestPermissions(permissions, requestCode, listener);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@Override
|
|
234
|
+
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
|
235
|
+
mDelegate.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
236
|
+
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
public void onWindowFocusChanged(boolean hasFocus) {
|
|
240
|
+
super.onWindowFocusChanged(hasFocus);
|
|
241
|
+
this.mDelegate.onWindowFocusChanged(hasFocus);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
public void onConfigurationChanged(@NonNull Configuration newConfig) {
|
|
245
|
+
super.onConfigurationChanged(newConfig);
|
|
246
|
+
this.mDelegate.onConfigurationChanged(newConfig);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@NonNull
|
|
250
|
+
protected ReactManager getReactManager() {
|
|
251
|
+
return mDelegate.getReactManager();
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
protected final ReactContext getCurrentReactContext() {
|
|
255
|
+
return mDelegate.getCurrentReactContext();
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
protected boolean isReactModuleRegisterCompleted() {
|
|
259
|
+
return getReactManager().isReactModuleRegisterCompleted();
|
|
260
|
+
}
|
|
246
261
|
}
|