react-native-tvos 0.74.0-0rc0 → 0.74.0-0rc2
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/Libraries/AppDelegate/RCTAppDelegate.mm +10 -5
- package/Libraries/AppDelegate/RCTRootViewFactory.h +13 -3
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +25 -10
- package/Libraries/Components/Pressable/Pressable.js +9 -13
- package/Libraries/Components/Touchable/TVTouchable.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +2 -2
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
- package/Libraries/Components/Touchable/TouchableOpacity.js +2 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Pressability/Pressability.js +5 -0
- package/Libraries/ReactNative/AppContainer-dev.js +21 -2
- package/React/Base/RCTBridge+Inspector.h +30 -0
- package/React/Base/RCTBridge+Private.h +0 -20
- package/React/Base/RCTBridge.mm +1 -0
- package/React/Base/RCTBridgeProxy.h +6 -1
- package/React/Base/RCTBridgeProxy.mm +4 -2
- package/React/Base/RCTTVNavigationEventNotification.h +37 -0
- package/React/Base/RCTTVNavigationEventNotification.mm +106 -0
- package/React/Base/RCTTVNavigationEventNotificationConstants.h +25 -0
- package/React/Base/RCTTVNavigationEventNotificationConstants.mm +18 -0
- package/React/Base/RCTTVRemoteHandler.h +0 -26
- package/React/Base/RCTTVRemoteHandler.m +34 -90
- package/React/Base/RCTTVRemoteHandlerConstants.h +37 -0
- package/React/Base/RCTTVRemoteHandlerConstants.mm +32 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTDevSettings.mm +1 -0
- package/React/CoreModules/RCTDeviceInfo.mm +15 -16
- package/React/CoreModules/RCTTVNavigationEventEmitter.mm +2 -1
- package/React/CxxBridge/RCTCxxBridge.mm +1 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +11 -12
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +6 -17
- package/React/Fabric/RCTSurfacePointerHandler.mm +1 -0
- package/React/Modules/RCTUIManager.m +10 -0
- package/React/Views/RCTTVView.m +6 -17
- package/React/Views/ScrollView/RCTScrollView.m +11 -12
- package/ReactAndroid/api/ReactAndroid.api +25 -1
- package/ReactAndroid/build.gradle.kts +18 -6
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle.kts +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +14 -36
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +106 -9
- package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/InteropUiBlockListener.kt +8 -2
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +12 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +64 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +6 -1
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +17 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +4 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +1 -1
- package/ReactCommon/react/runtime/React-RuntimeCore.podspec +1 -1
- package/ReactCommon/react/runtime/hermes/HermesInstance.cpp +0 -1
- package/ReactCommon/react/runtime/iostests/RCTHostTests.mm +2 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h +0 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +10 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +32 -9
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h +2 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +6 -12
- package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.h +1 -1
- package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.mm +3 -2
- package/ReactCommon/yoga/Yoga.podspec +4 -1
- package/package.json +22 -14
- package/scripts/cocoapods/helpers.rb +4 -0
- package/scripts/cocoapods/utils.rb +27 -7
- package/scripts/react_native_pods.rb +2 -0
- package/scripts/xcode/ccache-clang++.sh +14 -0
- package/scripts/xcode/ccache-clang.sh +14 -0
- package/scripts/xcode/ccache.conf +11 -0
- package/sdks/hermes-engine/utils/build-ios-framework.sh +5 -0
- package/sdks/hermes-engine/utils/build-mac-framework.sh +5 -0
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/ios/HelloWorld/PrivacyInfo.xcprivacy +38 -0
- package/template/package.json +6 -6
- package/third-party-podspecs/RCT-Folly.podspec +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.java +0 -23
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
#import "RCTConvert.h"
|
|
13
13
|
#import "RCTLog.h"
|
|
14
14
|
#import "RCTScrollEvent.h"
|
|
15
|
+
#import "RCTTVNavigationEventNotification.h"
|
|
15
16
|
#import "RCTUIManager.h"
|
|
16
17
|
#import "RCTUIManagerObserverCoordinator.h"
|
|
17
18
|
#import "RCTUIManagerUtils.h"
|
|
@@ -1016,22 +1017,22 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
|
|
1016
1017
|
- (void) addArrowsListeners {
|
|
1017
1018
|
[[NSNotificationCenter defaultCenter] addObserver:self
|
|
1018
1019
|
selector:@selector(handleTVNavigationEventNotification:)
|
|
1019
|
-
name
|
|
1020
|
+
name:RCTTVNavigationEventNotificationName
|
|
1020
1021
|
object:nil];
|
|
1021
1022
|
}
|
|
1022
1023
|
|
|
1023
1024
|
- (void) removeArrowsListeners {
|
|
1024
1025
|
[[NSNotificationCenter defaultCenter] removeObserver:self
|
|
1025
|
-
name
|
|
1026
|
+
name:RCTTVNavigationEventNotificationName
|
|
1026
1027
|
object:nil];
|
|
1027
1028
|
}
|
|
1028
1029
|
|
|
1029
1030
|
|
|
1030
1031
|
- (void)handleTVNavigationEventNotification:(NSNotification *)notif
|
|
1031
1032
|
{
|
|
1032
|
-
NSArray *supportedEvents = [NSArray arrayWithObjects
|
|
1033
|
+
NSArray *supportedEvents = [NSArray arrayWithObjects:RCTTVRemoteEventUp, RCTTVRemoteEventDown, RCTTVRemoteEventLeft, RCTTVRemoteEventRight, nil];
|
|
1033
1034
|
|
|
1034
|
-
if (notif.object == nil || notif.object[
|
|
1035
|
+
if (notif.object == nil || notif.object[RCTTVNavigationEventNotificationKeyEventType] == nil || ![supportedEvents containsObject:notif.object[RCTTVNavigationEventNotificationKeyEventType]]) {
|
|
1035
1036
|
return;
|
|
1036
1037
|
}
|
|
1037
1038
|
|
|
@@ -1041,23 +1042,23 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
|
|
1041
1042
|
}
|
|
1042
1043
|
|
|
1043
1044
|
if (![self isHorizontal:self.scrollView]) {
|
|
1044
|
-
if ([notif.object[
|
|
1045
|
+
if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventDown]) {
|
|
1045
1046
|
[self swipedDown];
|
|
1046
1047
|
return;
|
|
1047
1048
|
}
|
|
1048
1049
|
|
|
1049
|
-
if ([notif.object[
|
|
1050
|
+
if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventUp]) {
|
|
1050
1051
|
[self swipedUp];
|
|
1051
1052
|
return;
|
|
1052
1053
|
}
|
|
1053
1054
|
}
|
|
1054
1055
|
|
|
1055
|
-
if ([notif.object[
|
|
1056
|
+
if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventLeft]) {
|
|
1056
1057
|
[self swipedLeft];
|
|
1057
1058
|
return;
|
|
1058
1059
|
}
|
|
1059
1060
|
|
|
1060
|
-
if ([notif.object[
|
|
1061
|
+
if ([notif.object[RCTTVNavigationEventNotificationKeyEventType] isEqual:RCTTVRemoteEventRight]) {
|
|
1061
1062
|
[self swipedRight];
|
|
1062
1063
|
return;
|
|
1063
1064
|
}
|
|
@@ -1085,14 +1086,12 @@ RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop)
|
|
|
1085
1086
|
|
|
1086
1087
|
- (void)sendFocusNotification
|
|
1087
1088
|
{
|
|
1088
|
-
|
|
1089
|
-
object:@{@"eventType":@"focus",@"tag":self.reactTag}];
|
|
1089
|
+
[[NSNotificationCenter defaultCenter] postNavigationFocusEventWithTag:self.reactTag target:nil];
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
1092
|
- (void)sendBlurNotification
|
|
1093
1093
|
{
|
|
1094
|
-
|
|
1095
|
-
object:@{@"eventType":@"blur",@"tag":self.reactTag}];
|
|
1094
|
+
[[NSNotificationCenter defaultCenter] postNavigationBlurEventWithTag:self.reactTag target:nil];
|
|
1096
1095
|
}
|
|
1097
1096
|
|
|
1098
1097
|
- (NSInteger)swipeVerticalInterval
|
|
@@ -29,6 +29,15 @@ public class com/facebook/react/CoreModulesPackage$$ReactModuleInfoProvider : co
|
|
|
29
29
|
public fun getReactModuleInfos ()Ljava/util/Map;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
public class com/facebook/react/DebugCorePackage : com/facebook/react/TurboReactPackage, com/facebook/react/ViewManagerOnDemandReactPackage {
|
|
33
|
+
public fun <init> ()V
|
|
34
|
+
public fun createViewManager (Lcom/facebook/react/bridge/ReactApplicationContext;Ljava/lang/String;)Lcom/facebook/react/uimanager/ViewManager;
|
|
35
|
+
public fun getModule (Ljava/lang/String;Lcom/facebook/react/bridge/ReactApplicationContext;)Lcom/facebook/react/bridge/NativeModule;
|
|
36
|
+
public fun getReactModuleInfoProvider ()Lcom/facebook/react/module/model/ReactModuleInfoProvider;
|
|
37
|
+
public fun getViewManagerNames (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/Collection;
|
|
38
|
+
public fun getViewManagers (Lcom/facebook/react/bridge/ReactApplicationContext;)Ljava/util/List;
|
|
39
|
+
}
|
|
40
|
+
|
|
32
41
|
public class com/facebook/react/DebugCorePackage$$ReactModuleInfoProvider : com/facebook/react/module/model/ReactModuleInfoProvider {
|
|
33
42
|
public fun <init> ()V
|
|
34
43
|
public fun getReactModuleInfos ()Ljava/util/Map;
|
|
@@ -83,6 +92,7 @@ public abstract class com/facebook/react/ReactActivity : androidx/appcompat/app/
|
|
|
83
92
|
protected fun <init> ()V
|
|
84
93
|
protected fun createReactActivityDelegate ()Lcom/facebook/react/ReactActivityDelegate;
|
|
85
94
|
protected fun getMainComponentName ()Ljava/lang/String;
|
|
95
|
+
public fun getReactDelegate ()V
|
|
86
96
|
protected final fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
|
|
87
97
|
protected final fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
|
|
88
98
|
public fun invokeDefaultOnBackPressed ()V
|
|
@@ -113,6 +123,7 @@ public class com/facebook/react/ReactActivityDelegate {
|
|
|
113
123
|
protected fun getLaunchOptions ()Landroid/os/Bundle;
|
|
114
124
|
public fun getMainComponentName ()Ljava/lang/String;
|
|
115
125
|
protected fun getPlainActivity ()Landroid/app/Activity;
|
|
126
|
+
protected fun getReactDelegate ()Lcom/facebook/react/ReactDelegate;
|
|
116
127
|
public fun getReactHost ()Lcom/facebook/react/ReactHost;
|
|
117
128
|
public fun getReactInstanceManager ()Lcom/facebook/react/ReactInstanceManager;
|
|
118
129
|
protected fun getReactNativeHost ()Lcom/facebook/react/ReactNativeHost;
|
|
@@ -151,9 +162,15 @@ public class com/facebook/react/ReactDelegate {
|
|
|
151
162
|
public fun loadApp (Ljava/lang/String;)V
|
|
152
163
|
public fun onActivityResult (IILandroid/content/Intent;Z)V
|
|
153
164
|
public fun onBackPressed ()Z
|
|
165
|
+
public fun onConfigurationChanged (Landroid/content/res/Configuration;)V
|
|
154
166
|
public fun onHostDestroy ()V
|
|
155
167
|
public fun onHostPause ()V
|
|
156
168
|
public fun onHostResume ()V
|
|
169
|
+
public fun onKeyDown (ILandroid/view/KeyEvent;)Z
|
|
170
|
+
public fun onKeyLongPress (I)Z
|
|
171
|
+
public fun onNewIntent (Landroid/content/Intent;)Z
|
|
172
|
+
public fun onWindowFocusChanged (Z)V
|
|
173
|
+
public fun reload ()V
|
|
157
174
|
public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
|
|
158
175
|
}
|
|
159
176
|
|
|
@@ -198,12 +215,15 @@ public abstract interface class com/facebook/react/ReactHost {
|
|
|
198
215
|
public abstract fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
|
|
199
216
|
public abstract fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
|
|
200
217
|
public abstract fun onBackPressed ()Z
|
|
218
|
+
public abstract fun onConfigurationChanged (Landroid/content/Context;)V
|
|
201
219
|
public abstract fun onHostDestroy ()V
|
|
202
220
|
public abstract fun onHostDestroy (Landroid/app/Activity;)V
|
|
203
221
|
public abstract fun onHostPause ()V
|
|
204
222
|
public abstract fun onHostPause (Landroid/app/Activity;)V
|
|
205
223
|
public abstract fun onHostResume (Landroid/app/Activity;)V
|
|
206
224
|
public abstract fun onHostResume (Landroid/app/Activity;Lcom/facebook/react/modules/core/DefaultHardwareBackBtnHandler;)V
|
|
225
|
+
public abstract fun onNewIntent (Landroid/content/Intent;)V
|
|
226
|
+
public abstract fun onWindowFocusChange (Z)V
|
|
207
227
|
public abstract fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
|
|
208
228
|
public abstract fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
|
|
209
229
|
public abstract fun setJsEngineResolutionAlgorithm (Lcom/facebook/react/JSEngineResolutionAlgorithm;)V
|
|
@@ -2516,7 +2536,7 @@ public class com/facebook/react/fabric/FabricSoLoader {
|
|
|
2516
2536
|
public static fun staticInit ()V
|
|
2517
2537
|
}
|
|
2518
2538
|
|
|
2519
|
-
public class com/facebook/react/fabric/FabricUIManager : com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/UIManager {
|
|
2539
|
+
public class com/facebook/react/fabric/FabricUIManager : com/facebook/react/bridge/LifecycleEventListener, com/facebook/react/bridge/UIManager, com/facebook/react/fabric/interop/UIBlockViewResolver {
|
|
2520
2540
|
public static final field ENABLE_FABRIC_LOGS Z
|
|
2521
2541
|
public static final field ENABLE_FABRIC_PERF_LOGS Z
|
|
2522
2542
|
public static final field IS_DEVELOPMENT_ENVIRONMENT Z
|
|
@@ -3646,12 +3666,15 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
|
|
|
3646
3666
|
public fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
|
|
3647
3667
|
public fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
|
|
3648
3668
|
public fun onBackPressed ()Z
|
|
3669
|
+
public fun onConfigurationChanged (Landroid/content/Context;)V
|
|
3649
3670
|
public fun onHostDestroy ()V
|
|
3650
3671
|
public fun onHostDestroy (Landroid/app/Activity;)V
|
|
3651
3672
|
public fun onHostPause ()V
|
|
3652
3673
|
public fun onHostPause (Landroid/app/Activity;)V
|
|
3653
3674
|
public fun onHostResume (Landroid/app/Activity;)V
|
|
3654
3675
|
public fun onHostResume (Landroid/app/Activity;Lcom/facebook/react/modules/core/DefaultHardwareBackBtnHandler;)V
|
|
3676
|
+
public fun onNewIntent (Landroid/content/Intent;)V
|
|
3677
|
+
public fun onWindowFocusChange (Z)V
|
|
3655
3678
|
public fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
|
|
3656
3679
|
public fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
|
|
3657
3680
|
public fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
|
|
@@ -4874,6 +4897,7 @@ public class com/facebook/react/uimanager/UIImplementation {
|
|
|
4874
4897
|
public fun dispatchViewUpdates (I)V
|
|
4875
4898
|
public fun findSubviewIn (IFFLcom/facebook/react/bridge/Callback;)V
|
|
4876
4899
|
public fun getProfiledBatchPerfCounters ()Ljava/util/Map;
|
|
4900
|
+
public fun getRootViewNum ()I
|
|
4877
4901
|
protected fun handleCreateView (Lcom/facebook/react/uimanager/ReactShadowNode;ILcom/facebook/react/uimanager/ReactStylesDiffMap;)V
|
|
4878
4902
|
protected fun handleUpdateView (Lcom/facebook/react/uimanager/ReactShadowNode;Ljava/lang/String;Lcom/facebook/react/uimanager/ReactStylesDiffMap;)V
|
|
4879
4903
|
public fun manageChildren (ILcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;Lcom/facebook/react/bridge/ReadableArray;)V
|
|
@@ -129,14 +129,24 @@ val preparePrefab by
|
|
|
129
129
|
)),
|
|
130
130
|
PrefabPreprocessingEntry(
|
|
131
131
|
"rrc_text",
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
listOf(
|
|
133
|
+
Pair(
|
|
134
|
+
"../ReactCommon/react/renderer/components/text/",
|
|
135
|
+
"react/renderer/components/text/"),
|
|
136
|
+
Pair(
|
|
137
|
+
"../ReactCommon/react/renderer/attributedstring",
|
|
138
|
+
"react/renderer/attributedstring"),
|
|
139
|
+
)),
|
|
135
140
|
PrefabPreprocessingEntry(
|
|
136
141
|
"rrc_textinput",
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
142
|
+
listOf(
|
|
143
|
+
Pair(
|
|
144
|
+
"../ReactCommon/react/renderer/components/textinput/",
|
|
145
|
+
"react/renderer/components/textinput/"),
|
|
146
|
+
Pair(
|
|
147
|
+
"../ReactCommon/react/renderer/components/textinput/platform/android/",
|
|
148
|
+
""),
|
|
149
|
+
)),
|
|
140
150
|
PrefabPreprocessingEntry(
|
|
141
151
|
"rrc_legacyviewmanagerinterop",
|
|
142
152
|
Pair(
|
|
@@ -490,6 +500,8 @@ android {
|
|
|
490
500
|
}
|
|
491
501
|
if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
|
|
492
502
|
ndkVersion = rootProject.properties["ndkVersion"].toString()
|
|
503
|
+
} else {
|
|
504
|
+
ndkVersion = libs.versions.ndkVersion.get()
|
|
493
505
|
}
|
|
494
506
|
|
|
495
507
|
compileOptions {
|
|
@@ -194,6 +194,8 @@ android {
|
|
|
194
194
|
}
|
|
195
195
|
if (rootProject.hasProperty("ndkVersion") && rootProject.properties["ndkVersion"] != null) {
|
|
196
196
|
ndkVersion = rootProject.properties["ndkVersion"].toString()
|
|
197
|
+
} else {
|
|
198
|
+
ndkVersion = libs.versions.ndkVersion.get()
|
|
197
199
|
}
|
|
198
200
|
|
|
199
201
|
defaultConfig {
|
|
@@ -36,7 +36,7 @@ import javax.inject.Provider;
|
|
|
36
36
|
JSCHeapCapture.class,
|
|
37
37
|
})
|
|
38
38
|
/* package */
|
|
39
|
-
class DebugCorePackage extends TurboReactPackage implements ViewManagerOnDemandReactPackage {
|
|
39
|
+
public class DebugCorePackage extends TurboReactPackage implements ViewManagerOnDemandReactPackage {
|
|
40
40
|
private @Nullable Map<String, ModuleSpec> mViewManagers;
|
|
41
41
|
|
|
42
42
|
public DebugCorePackage() {}
|
|
@@ -65,6 +65,10 @@ public abstract class ReactActivity extends AppCompatActivity
|
|
|
65
65
|
mDelegate.onDestroy();
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
public void getReactDelegate() {
|
|
69
|
+
mDelegate.getReactDelegate();
|
|
70
|
+
}
|
|
71
|
+
|
|
68
72
|
@Override
|
|
69
73
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
70
74
|
super.onActivityResult(requestCode, resultCode, data);
|
|
@@ -88,6 +88,10 @@ public class ReactActivityDelegate {
|
|
|
88
88
|
return ((ReactApplication) getPlainActivity().getApplication()).getReactHost();
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
protected @Nullable ReactDelegate getReactDelegate() {
|
|
92
|
+
return mReactDelegate;
|
|
93
|
+
}
|
|
94
|
+
|
|
91
95
|
public ReactInstanceManager getReactInstanceManager() {
|
|
92
96
|
return mReactDelegate.getReactInstanceManager();
|
|
93
97
|
}
|
|
@@ -105,7 +109,11 @@ public class ReactActivityDelegate {
|
|
|
105
109
|
} else {
|
|
106
110
|
mReactDelegate =
|
|
107
111
|
new ReactDelegate(
|
|
108
|
-
getPlainActivity(),
|
|
112
|
+
getPlainActivity(),
|
|
113
|
+
getReactNativeHost(),
|
|
114
|
+
mainComponentName,
|
|
115
|
+
launchOptions,
|
|
116
|
+
isFabricEnabled()) {
|
|
109
117
|
@Override
|
|
110
118
|
protected ReactRootView createRootView() {
|
|
111
119
|
return ReactActivityDelegate.this.createRootView(launchOptions);
|
|
@@ -144,15 +152,7 @@ public class ReactActivityDelegate {
|
|
|
144
152
|
}
|
|
145
153
|
|
|
146
154
|
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
147
|
-
|
|
148
|
-
if (getReactNativeHost().hasInstance()
|
|
149
|
-
&& getReactNativeHost().getUseDeveloperSupport()
|
|
150
|
-
&& keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
|
151
|
-
event.startTracking();
|
|
152
|
-
return true;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return false;
|
|
155
|
+
return mReactDelegate.onKeyDown(keyCode, event);
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
|
@@ -160,15 +160,7 @@ public class ReactActivityDelegate {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
public boolean onKeyLongPress(int keyCode, KeyEvent event) {
|
|
163
|
-
|
|
164
|
-
if (getReactNativeHost().hasInstance()
|
|
165
|
-
&& getReactNativeHost().getUseDeveloperSupport()
|
|
166
|
-
&& keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
|
167
|
-
getReactNativeHost().getReactInstanceManager().showDevOptionsDialog();
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return false;
|
|
163
|
+
return mReactDelegate.onKeyLongPress(keyCode);
|
|
172
164
|
}
|
|
173
165
|
|
|
174
166
|
public boolean onBackPressed() {
|
|
@@ -176,29 +168,15 @@ public class ReactActivityDelegate {
|
|
|
176
168
|
}
|
|
177
169
|
|
|
178
170
|
public boolean onNewIntent(Intent intent) {
|
|
179
|
-
|
|
180
|
-
if (getReactNativeHost().hasInstance()) {
|
|
181
|
-
getReactNativeHost().getReactInstanceManager().onNewIntent(intent);
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
return false;
|
|
171
|
+
return mReactDelegate.onNewIntent(intent);
|
|
186
172
|
}
|
|
187
173
|
|
|
188
174
|
public void onWindowFocusChanged(boolean hasFocus) {
|
|
189
|
-
|
|
190
|
-
if (getReactNativeHost().hasInstance()) {
|
|
191
|
-
getReactNativeHost().getReactInstanceManager().onWindowFocusChange(hasFocus);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
175
|
+
mReactDelegate.onWindowFocusChanged(hasFocus);
|
|
194
176
|
}
|
|
195
177
|
|
|
196
178
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
197
|
-
|
|
198
|
-
if (getReactNativeHost().hasInstance()) {
|
|
199
|
-
getReactInstanceManager().onConfigurationChanged(getContext(), newConfig);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
179
|
+
mReactDelegate.onConfigurationChanged(newConfig);
|
|
202
180
|
}
|
|
203
181
|
|
|
204
182
|
public void requestPermissions(
|
|
@@ -9,12 +9,14 @@ package com.facebook.react;
|
|
|
9
9
|
|
|
10
10
|
import android.app.Activity;
|
|
11
11
|
import android.content.Intent;
|
|
12
|
+
import android.content.res.Configuration;
|
|
12
13
|
import android.os.Bundle;
|
|
13
14
|
import android.view.KeyEvent;
|
|
14
15
|
import androidx.annotation.NonNull;
|
|
15
16
|
import androidx.annotation.Nullable;
|
|
16
17
|
import com.facebook.infer.annotation.Assertions;
|
|
17
18
|
import com.facebook.react.config.ReactFeatureFlags;
|
|
19
|
+
import com.facebook.react.devsupport.DisabledDevSupportManager;
|
|
18
20
|
import com.facebook.react.devsupport.DoubleTapReloadRecognizer;
|
|
19
21
|
import com.facebook.react.devsupport.interfaces.DevSupportManager;
|
|
20
22
|
import com.facebook.react.interfaces.fabric.ReactSurface;
|
|
@@ -43,6 +45,15 @@ public class ReactDelegate {
|
|
|
43
45
|
|
|
44
46
|
private boolean mFabricEnabled = false;
|
|
45
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Do not use this constructor as it's not accounting for New Architecture at all. You should
|
|
50
|
+
* either use {@link ReactDelegate#ReactDelegate(Activity, ReactHost, String, Bundle)} if you're
|
|
51
|
+
* on bridgeless mode or {@link ReactDelegate#ReactDelegate(Activity, ReactNativeHost, String,
|
|
52
|
+
* Bundle, boolean)} and use the last parameter to toggle paper/fabric.
|
|
53
|
+
*
|
|
54
|
+
* @deprecated Use one of the other constructors instead to account for New Architecture.
|
|
55
|
+
*/
|
|
56
|
+
@Deprecated
|
|
46
57
|
public ReactDelegate(
|
|
47
58
|
Activity activity,
|
|
48
59
|
ReactNativeHost reactNativeHost,
|
|
@@ -81,6 +92,20 @@ public class ReactDelegate {
|
|
|
81
92
|
mReactNativeHost = reactNativeHost;
|
|
82
93
|
}
|
|
83
94
|
|
|
95
|
+
@Nullable
|
|
96
|
+
private DevSupportManager getDevSupportManager() {
|
|
97
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture
|
|
98
|
+
&& mReactHost != null
|
|
99
|
+
&& mReactHost.getDevSupportManager() != null) {
|
|
100
|
+
return mReactHost.getDevSupportManager();
|
|
101
|
+
} else if (getReactNativeHost().hasInstance()
|
|
102
|
+
&& getReactNativeHost().getUseDeveloperSupport()) {
|
|
103
|
+
return getReactNativeHost().getReactInstanceManager().getDevSupportManager();
|
|
104
|
+
} else {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
84
109
|
public void onHostResume() {
|
|
85
110
|
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
86
111
|
if (mActivity instanceof DefaultHardwareBackBtnHandler) {
|
|
@@ -137,6 +162,19 @@ public class ReactDelegate {
|
|
|
137
162
|
return false;
|
|
138
163
|
}
|
|
139
164
|
|
|
165
|
+
public boolean onNewIntent(Intent intent) {
|
|
166
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
167
|
+
mReactHost.onNewIntent(intent);
|
|
168
|
+
return true;
|
|
169
|
+
} else {
|
|
170
|
+
if (getReactNativeHost().hasInstance()) {
|
|
171
|
+
getReactNativeHost().getReactInstanceManager().onNewIntent(intent);
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
140
178
|
public void onActivityResult(
|
|
141
179
|
int requestCode, int resultCode, Intent data, boolean shouldForwardToReactInstance) {
|
|
142
180
|
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
@@ -150,6 +188,72 @@ public class ReactDelegate {
|
|
|
150
188
|
}
|
|
151
189
|
}
|
|
152
190
|
|
|
191
|
+
public void onWindowFocusChanged(boolean hasFocus) {
|
|
192
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
193
|
+
mReactHost.onWindowFocusChange(hasFocus);
|
|
194
|
+
} else {
|
|
195
|
+
if (getReactNativeHost().hasInstance()) {
|
|
196
|
+
getReactNativeHost().getReactInstanceManager().onWindowFocusChange(hasFocus);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
public void onConfigurationChanged(Configuration newConfig) {
|
|
202
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
|
203
|
+
mReactHost.onConfigurationChanged(Assertions.assertNotNull(mActivity));
|
|
204
|
+
} else {
|
|
205
|
+
if (getReactNativeHost().hasInstance()) {
|
|
206
|
+
getReactInstanceManager()
|
|
207
|
+
.onConfigurationChanged(Assertions.assertNotNull(mActivity), newConfig);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
213
|
+
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD
|
|
214
|
+
&& ((ReactFeatureFlags.enableBridgelessArchitecture
|
|
215
|
+
&& mReactHost != null
|
|
216
|
+
&& mReactHost.getDevSupportManager() != null)
|
|
217
|
+
|| (getReactNativeHost().hasInstance()
|
|
218
|
+
&& getReactNativeHost().getUseDeveloperSupport()))) {
|
|
219
|
+
event.startTracking();
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
public boolean onKeyLongPress(int keyCode) {
|
|
226
|
+
if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) {
|
|
227
|
+
if (ReactFeatureFlags.enableBridgelessArchitecture
|
|
228
|
+
&& mReactHost != null
|
|
229
|
+
&& mReactHost.getDevSupportManager() != null) {
|
|
230
|
+
mReactHost.getDevSupportManager().showDevOptionsDialog();
|
|
231
|
+
return true;
|
|
232
|
+
} else {
|
|
233
|
+
if (getReactNativeHost().hasInstance() && getReactNativeHost().getUseDeveloperSupport()) {
|
|
234
|
+
getReactNativeHost().getReactInstanceManager().showDevOptionsDialog();
|
|
235
|
+
return true;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return false;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
public void reload() {
|
|
243
|
+
DevSupportManager devSupportManager = getDevSupportManager();
|
|
244
|
+
if (devSupportManager != null) {
|
|
245
|
+
// With Bridgeless enabled, reload in RELEASE mode
|
|
246
|
+
if (devSupportManager instanceof DisabledDevSupportManager
|
|
247
|
+
&& ReactFeatureFlags.enableBridgelessArchitecture
|
|
248
|
+
&& mReactHost != null) {
|
|
249
|
+
// Do not reload the bundle from JS as there is no bundler running in release mode.
|
|
250
|
+
mReactHost.reload("ReactDelegate.reload()");
|
|
251
|
+
} else {
|
|
252
|
+
devSupportManager.handleReloadJS();
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
153
257
|
public void loadApp() {
|
|
154
258
|
loadApp(mMainComponentName);
|
|
155
259
|
}
|
|
@@ -196,15 +300,8 @@ public class ReactDelegate {
|
|
|
196
300
|
* application.
|
|
197
301
|
*/
|
|
198
302
|
public boolean shouldShowDevMenuOrReload(int keyCode, KeyEvent event) {
|
|
199
|
-
DevSupportManager devSupportManager =
|
|
200
|
-
if (
|
|
201
|
-
&& mReactHost != null
|
|
202
|
-
&& mReactHost.getDevSupportManager() != null) {
|
|
203
|
-
devSupportManager = mReactHost.getDevSupportManager();
|
|
204
|
-
} else if (getReactNativeHost().hasInstance()
|
|
205
|
-
&& getReactNativeHost().getUseDeveloperSupport()) {
|
|
206
|
-
devSupportManager = getReactNativeHost().getReactInstanceManager().getDevSupportManager();
|
|
207
|
-
} else {
|
|
303
|
+
DevSupportManager devSupportManager = getDevSupportManager();
|
|
304
|
+
if (devSupportManager == null) {
|
|
208
305
|
return false;
|
|
209
306
|
}
|
|
210
307
|
|
|
@@ -120,6 +120,14 @@ public interface ReactHost {
|
|
|
120
120
|
data: Intent?,
|
|
121
121
|
)
|
|
122
122
|
|
|
123
|
+
/* To be called when focus has changed for the hosting window. */
|
|
124
|
+
public fun onWindowFocusChange(hasFocus: Boolean)
|
|
125
|
+
|
|
126
|
+
/* This method will give JS the opportunity to receive intents via Linking. */
|
|
127
|
+
public fun onNewIntent(intent: Intent)
|
|
128
|
+
|
|
129
|
+
public fun onConfigurationChanged(context: Context)
|
|
130
|
+
|
|
123
131
|
public fun addBeforeDestroyListener(onBeforeDestroy: () -> Unit)
|
|
124
132
|
|
|
125
133
|
public fun removeBeforeDestroyListener(onBeforeDestroy: () -> Unit)
|
|
@@ -57,6 +57,7 @@ import com.facebook.react.fabric.events.EventEmitterWrapper;
|
|
|
57
57
|
import com.facebook.react.fabric.events.FabricEventEmitter;
|
|
58
58
|
import com.facebook.react.fabric.internal.interop.InteropUIBlockListener;
|
|
59
59
|
import com.facebook.react.fabric.interop.UIBlock;
|
|
60
|
+
import com.facebook.react.fabric.interop.UIBlockViewResolver;
|
|
60
61
|
import com.facebook.react.fabric.mounting.MountItemDispatcher;
|
|
61
62
|
import com.facebook.react.fabric.mounting.MountingManager;
|
|
62
63
|
import com.facebook.react.fabric.mounting.SurfaceMountingManager;
|
|
@@ -99,7 +100,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
99
100
|
*/
|
|
100
101
|
@SuppressLint("MissingNativeLoadLibrary")
|
|
101
102
|
@DoNotStripAny
|
|
102
|
-
public class FabricUIManager implements UIManager, LifecycleEventListener {
|
|
103
|
+
public class FabricUIManager implements UIManager, LifecycleEventListener, UIBlockViewResolver {
|
|
103
104
|
public static final String TAG = FabricUIManager.class.getSimpleName();
|
|
104
105
|
|
|
105
106
|
// The IS_DEVELOPMENT_ENVIRONMENT variable is used to log extra data when running fabric in a
|
|
@@ -37,6 +37,9 @@ internal class InteropUIBlockListener : UIManagerListener {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
override fun willMountItems(uiManager: UIManager) {
|
|
40
|
+
if (beforeUIBlocks.isEmpty()) {
|
|
41
|
+
return
|
|
42
|
+
}
|
|
40
43
|
beforeUIBlocks.forEach {
|
|
41
44
|
if (uiManager is UIBlockViewResolver) {
|
|
42
45
|
it.execute(uiManager)
|
|
@@ -46,6 +49,9 @@ internal class InteropUIBlockListener : UIManagerListener {
|
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
override fun didMountItems(uiManager: UIManager) {
|
|
52
|
+
if (afterUIBlocks.isEmpty()) {
|
|
53
|
+
return
|
|
54
|
+
}
|
|
49
55
|
afterUIBlocks.forEach {
|
|
50
56
|
if (uiManager is UIBlockViewResolver) {
|
|
51
57
|
it.execute(uiManager)
|
|
@@ -54,9 +60,9 @@ internal class InteropUIBlockListener : UIManagerListener {
|
|
|
54
60
|
afterUIBlocks.clear()
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
override fun
|
|
63
|
+
override fun didDispatchMountItems(uiManager: UIManager) = didMountItems(uiManager)
|
|
58
64
|
|
|
59
|
-
override fun
|
|
65
|
+
override fun willDispatchViewUpdates(uiManager: UIManager) = willMountItems(uiManager)
|
|
60
66
|
|
|
61
67
|
override fun didScheduleMountItems(uiManager: UIManager) = Unit
|
|
62
68
|
}
|
|
@@ -91,6 +91,7 @@ public class ReactAndroidHWInputDeviceHelper {
|
|
|
91
91
|
// These are used for long press detection
|
|
92
92
|
private long mLastKeyDownTime = 0;
|
|
93
93
|
private boolean longPressEventActive = false;
|
|
94
|
+
private boolean longPressEventStarted = false;
|
|
94
95
|
|
|
95
96
|
public ReactAndroidHWInputDeviceHelper() {}
|
|
96
97
|
|
|
@@ -136,13 +137,16 @@ public class ReactAndroidHWInputDeviceHelper {
|
|
|
136
137
|
|
|
137
138
|
if (shouldDispatchEvent(eventKeyCode, eventKeyAction, time)) {
|
|
138
139
|
if(longPressEventActive) {
|
|
139
|
-
//
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
140
|
+
// For long presses, only send the first key down event (aligns with Apple TV gesture detection behavior)
|
|
141
|
+
if(!longPressEventStarted || eventKeyAction == KeyEvent.ACTION_UP) {
|
|
142
|
+
dispatchEvent(
|
|
143
|
+
KEY_EVENTS_LONG_PRESS_ACTIONS.get(eventKeyCode),
|
|
144
|
+
mLastFocusedViewId,
|
|
145
|
+
eventKeyAction,
|
|
146
|
+
context
|
|
147
|
+
);
|
|
148
|
+
longPressEventStarted = true;
|
|
149
|
+
}
|
|
146
150
|
// Update the start time for detecting the next long press event
|
|
147
151
|
mLastKeyDownTime = time;
|
|
148
152
|
} else {
|
|
@@ -154,6 +158,7 @@ public class ReactAndroidHWInputDeviceHelper {
|
|
|
154
158
|
if ((eventKeyAction == KeyEvent.ACTION_UP) && isSelectOrDPadEvent) {
|
|
155
159
|
mLastKeyDownTime = 0;
|
|
156
160
|
longPressEventActive = false;
|
|
161
|
+
longPressEventStarted = false;
|
|
157
162
|
}
|
|
158
163
|
|
|
159
164
|
}
|