react-native 0.74.0-rc.3 → 0.74.0-rc.5
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/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Core/registerCallableModule.d.ts +16 -0
- package/React/Base/RCTBridgeProxy+Cxx.h +20 -0
- package/React/Base/RCTBridgeProxy.h +2 -0
- package/React/Base/RCTBridgeProxy.mm +15 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +7 -0
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +17 -2
- package/ReactAndroid/api/ReactAndroid.api +57 -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/ReactActivity.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +9 -35
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +101 -15
- package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java +1 -1
- 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/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +201 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java +4 -6
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +79 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +1 -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/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +2 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h +2 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +8 -6
- package/ReactCommon/yoga/yoga/algorithm/AbsoluteLayout.cpp +64 -40
- package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +19 -20
- package/package.json +11 -11
- package/scripts/cocoapods/helpers.rb +4 -0
- package/scripts/cocoapods/utils.rb +26 -6
- package/scripts/react_native_pods.rb +2 -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/package.json +5 -5
- package/types/index.d.ts +1 -0
|
@@ -26,8 +26,8 @@ class JSIModuleRegistry {
|
|
|
26
26
|
return Assertions.assertNotNull(jsiModuleHolder.getJSIModule());
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
public void registerModules(List<JSIModuleSpec
|
|
30
|
-
for (JSIModuleSpec spec : jsiModules) {
|
|
29
|
+
public <T extends JSIModule> void registerModules(List<JSIModuleSpec<T>> jsiModules) {
|
|
30
|
+
for (JSIModuleSpec<T> spec : jsiModules) {
|
|
31
31
|
mModules.put(spec.getJSIModuleType(), new JSIModuleHolder(spec));
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -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
|
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
package com.facebook.react.runtime
|
|
9
|
+
|
|
10
|
+
import android.content.res.AssetManager
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import com.facebook.react.bridge.CatalystInstance
|
|
13
|
+
import com.facebook.react.bridge.JSIModule
|
|
14
|
+
import com.facebook.react.bridge.JSIModuleSpec
|
|
15
|
+
import com.facebook.react.bridge.JSIModuleType
|
|
16
|
+
import com.facebook.react.bridge.JavaScriptContextHolder
|
|
17
|
+
import com.facebook.react.bridge.JavaScriptModule
|
|
18
|
+
import com.facebook.react.bridge.NativeArray
|
|
19
|
+
import com.facebook.react.bridge.NativeArrayInterface
|
|
20
|
+
import com.facebook.react.bridge.NativeModule
|
|
21
|
+
import com.facebook.react.bridge.NativeModuleRegistry
|
|
22
|
+
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener
|
|
23
|
+
import com.facebook.react.bridge.RuntimeExecutor
|
|
24
|
+
import com.facebook.react.bridge.RuntimeScheduler
|
|
25
|
+
import com.facebook.react.bridge.UIManager
|
|
26
|
+
import com.facebook.react.bridge.queue.ReactQueueConfiguration
|
|
27
|
+
import com.facebook.react.common.annotations.DeprecatedInNewArchitecture
|
|
28
|
+
import com.facebook.react.common.annotations.VisibleForTesting
|
|
29
|
+
import com.facebook.react.internal.turbomodule.core.interfaces.TurboModuleRegistry
|
|
30
|
+
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder
|
|
31
|
+
import com.facebook.react.turbomodule.core.interfaces.NativeMethodCallInvokerHolder
|
|
32
|
+
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@DeprecatedInNewArchitecture
|
|
35
|
+
public class BridgelessCatalystInstance(private val reactHost: ReactHostImpl) : CatalystInstance {
|
|
36
|
+
|
|
37
|
+
override fun handleMemoryPressure(level: Int) {
|
|
38
|
+
throw UnsupportedOperationException("Unimplemented method 'handleMemoryPressure'")
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun loadScriptFromAssets(
|
|
42
|
+
assetManager: AssetManager,
|
|
43
|
+
assetURL: String,
|
|
44
|
+
loadSynchronously: Boolean
|
|
45
|
+
) {
|
|
46
|
+
throw UnsupportedOperationException("Unimplemented method 'loadScriptFromAssets'")
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
override fun loadScriptFromFile(fileName: String, sourceURL: String, loadSynchronously: Boolean) {
|
|
50
|
+
throw UnsupportedOperationException("Unimplemented method 'loadScriptFromFile'")
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
override fun loadSplitBundleFromFile(fileName: String, sourceURL: String) {
|
|
54
|
+
throw UnsupportedOperationException("Unimplemented method 'loadSplitBundleFromFile'")
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
override fun setSourceURLs(deviceURL: String, remoteURL: String) {
|
|
58
|
+
throw UnsupportedOperationException("Unimplemented method 'setSourceURLs'")
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
override fun runJSBundle() {
|
|
62
|
+
throw UnsupportedOperationException("Unimplemented method 'runJSBundle'")
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
override fun hasRunJSBundle(): Boolean {
|
|
66
|
+
throw UnsupportedOperationException("Unimplemented method 'hasRunJSBundle'")
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
override fun getSourceURL(): String? {
|
|
70
|
+
throw UnsupportedOperationException("Unimplemented method 'getSourceURL'")
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
override fun invokeCallback(callbackID: Int, arguments: NativeArrayInterface) {
|
|
75
|
+
throw UnsupportedOperationException("Unimplemented method 'invokeCallback'")
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
override fun callFunction(module: String, method: String, arguments: NativeArray) {
|
|
79
|
+
throw UnsupportedOperationException("Unimplemented method 'callFunction'")
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
override fun destroy() {
|
|
83
|
+
throw UnsupportedOperationException("Unimplemented method 'destroy'")
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
override fun isDestroyed(): Boolean {
|
|
87
|
+
throw UnsupportedOperationException("Unimplemented method 'isDestroyed'")
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@VisibleForTesting
|
|
91
|
+
override fun initialize() {
|
|
92
|
+
throw UnsupportedOperationException("Unimplemented method 'initialize'")
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
override fun getReactQueueConfiguration(): ReactQueueConfiguration {
|
|
96
|
+
throw UnsupportedOperationException("Unimplemented method 'getReactQueueConfiguration'")
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
override fun <T : JavaScriptModule> getJSModule(jsInterface: Class<T>): T {
|
|
100
|
+
throw UnsupportedOperationException("Unimplemented method 'getJSModule'")
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
override fun <T : NativeModule> hasNativeModule(nativeModuleInterface: Class<T>): Boolean {
|
|
104
|
+
throw UnsupportedOperationException("Unimplemented method 'hasNativeModule'")
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
override fun <T : NativeModule> getNativeModule(nativeModuleInterface: Class<T>): T? {
|
|
108
|
+
throw UnsupportedOperationException("Unimplemented method 'getNativeModule'")
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
override fun getNativeModule(moduleName: String): NativeModule? {
|
|
112
|
+
throw UnsupportedOperationException("Unimplemented method 'getNativeModule'")
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@Deprecated(
|
|
116
|
+
message =
|
|
117
|
+
"getJSIModule(JSIModuleType moduleType) is deprecated and will be deleted in the future. Please use ReactInstanceEventListener to subscribe for react instance events instead.")
|
|
118
|
+
override fun getJSIModule(moduleType: JSIModuleType): JSIModule {
|
|
119
|
+
throw UnsupportedOperationException("Unimplemented method 'getJSIModule'")
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
override fun getNativeModules(): Collection<NativeModule> {
|
|
123
|
+
throw UnsupportedOperationException("Unimplemented method 'getNativeModules'")
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
override fun extendNativeModules(modules: NativeModuleRegistry) {
|
|
127
|
+
throw UnsupportedOperationException("Unimplemented method 'extendNativeModules'")
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
override fun addBridgeIdleDebugListener(listener: NotThreadSafeBridgeIdleDebugListener) {
|
|
131
|
+
throw UnsupportedOperationException("Unimplemented method 'addBridgeIdleDebugListener'")
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
override fun removeBridgeIdleDebugListener(listener: NotThreadSafeBridgeIdleDebugListener) {
|
|
135
|
+
throw UnsupportedOperationException("Unimplemented method 'removeBridgeIdleDebugListener'")
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
override fun registerSegment(segmentId: Int, path: String) {
|
|
139
|
+
throw UnsupportedOperationException("Unimplemented method 'registerSegment'")
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@VisibleForTesting
|
|
143
|
+
override fun setGlobalVariable(propName: String, jsonValue: String) {
|
|
144
|
+
throw UnsupportedOperationException("Unimplemented method 'setGlobalVariable'")
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@Deprecated(message = "This API is unsupported in the New Architecture.")
|
|
148
|
+
override fun getJavaScriptContextHolder(): JavaScriptContextHolder {
|
|
149
|
+
throw UnsupportedOperationException("Unimplemented method 'getJavaScriptContextHolder'")
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
override fun getRuntimeExecutor(): RuntimeExecutor {
|
|
153
|
+
throw UnsupportedOperationException("Unimplemented method 'getRuntimeExecutor'")
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
override fun getRuntimeScheduler(): RuntimeScheduler {
|
|
157
|
+
throw UnsupportedOperationException("Unimplemented method 'getRuntimeScheduler'")
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
@Deprecated(message = "This API is unsupported in the New Architecture.")
|
|
161
|
+
override fun <T : JSIModule> addJSIModules(jsiModules: List<JSIModuleSpec<T>>) {
|
|
162
|
+
throw UnsupportedOperationException("Unimplemented method 'addJSIModules'")
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
override fun getJSCallInvokerHolder(): CallInvokerHolder? {
|
|
166
|
+
return reactHost.getJSCallInvokerHolder()
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
override fun getNativeMethodCallInvokerHolder(): NativeMethodCallInvokerHolder {
|
|
170
|
+
throw UnsupportedOperationException("Unimplemented method 'getNativeMethodCallInvokerHolder'")
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
@Deprecated(
|
|
174
|
+
message =
|
|
175
|
+
"setTurboModuleManager(JSIModule getter) is deprecated and will be deleted in the future. Please use setTurboModuleRegistry(TurboModuleRegistry turboModuleRegistry) instead.",
|
|
176
|
+
replaceWith = ReplaceWith("setTurboModuleRegistry(turboModuleRegistry)"))
|
|
177
|
+
override fun setTurboModuleManager(getter: JSIModule) {
|
|
178
|
+
throw UnsupportedOperationException("Unimplemented method 'setTurboModuleManager'")
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
@DeprecatedInNewArchitecture(
|
|
182
|
+
message =
|
|
183
|
+
"This method will be deprecated later as part of Stable APIs with bridge removal and not encouraged usage.")
|
|
184
|
+
override fun setTurboModuleRegistry(turboModuleRegistry: TurboModuleRegistry) {
|
|
185
|
+
throw UnsupportedOperationException("Unimplemented method 'setTurboModuleRegistry'")
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@DeprecatedInNewArchitecture(
|
|
189
|
+
message =
|
|
190
|
+
"This method will be deprecated later as part of Stable APIs with bridge removal and not encouraged usage.")
|
|
191
|
+
override fun setFabricUIManager(fabricUIManager: UIManager) {
|
|
192
|
+
throw UnsupportedOperationException("Unimplemented method 'setFabricUIManager'")
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@DeprecatedInNewArchitecture(
|
|
196
|
+
message =
|
|
197
|
+
"This method will be deprecated later as part of Stable APIs with bridge removal and not encouraged usage.")
|
|
198
|
+
override fun getFabricUIManager(): UIManager {
|
|
199
|
+
throw UnsupportedOperationException("Unimplemented method 'getFabricUIManager'")
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
package com.facebook.react.runtime;
|
|
9
9
|
|
|
10
10
|
import android.content.Context;
|
|
11
|
+
import android.util.Log;
|
|
11
12
|
import com.facebook.infer.annotation.Nullsafe;
|
|
12
13
|
import com.facebook.react.bridge.Arguments;
|
|
13
14
|
import com.facebook.react.bridge.Callback;
|
|
@@ -18,8 +19,6 @@ import com.facebook.react.bridge.JavaScriptModuleRegistry;
|
|
|
18
19
|
import com.facebook.react.bridge.NativeArray;
|
|
19
20
|
import com.facebook.react.bridge.NativeModule;
|
|
20
21
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
21
|
-
import com.facebook.react.bridge.ReactNoCrashBridgeNotAllowedSoftException;
|
|
22
|
-
import com.facebook.react.bridge.ReactSoftExceptionLogger;
|
|
23
22
|
import com.facebook.react.bridge.RuntimeExecutor;
|
|
24
23
|
import com.facebook.react.bridge.UIManager;
|
|
25
24
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
@@ -84,11 +83,10 @@ class BridgelessReactContext extends ReactApplicationContext implements EventDis
|
|
|
84
83
|
|
|
85
84
|
@Override
|
|
86
85
|
public CatalystInstance getCatalystInstance() {
|
|
87
|
-
|
|
86
|
+
Log.w(
|
|
88
87
|
TAG,
|
|
89
|
-
new
|
|
90
|
-
|
|
91
|
-
throw new UnsupportedOperationException("There is no Catalyst instance in bridgeless mode.");
|
|
88
|
+
"[WARNING] Bridgeless doesn't support CatalystInstance. Accessing an API that's not part of the new architecture is not encouraged usage.");
|
|
89
|
+
return new BridgelessCatalystInstance(mReactHost);
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
@Override
|
|
@@ -16,6 +16,8 @@ import static java.lang.Boolean.TRUE;
|
|
|
16
16
|
import android.app.Activity;
|
|
17
17
|
import android.content.Context;
|
|
18
18
|
import android.content.Intent;
|
|
19
|
+
import android.net.Uri;
|
|
20
|
+
import android.nfc.NfcAdapter;
|
|
19
21
|
import android.os.Bundle;
|
|
20
22
|
import androidx.annotation.NonNull;
|
|
21
23
|
import androidx.annotation.Nullable;
|
|
@@ -55,11 +57,13 @@ import com.facebook.react.fabric.FabricUIManager;
|
|
|
55
57
|
import com.facebook.react.interfaces.TaskInterface;
|
|
56
58
|
import com.facebook.react.interfaces.exceptionmanager.ReactJsExceptionHandler;
|
|
57
59
|
import com.facebook.react.interfaces.fabric.ReactSurface;
|
|
60
|
+
import com.facebook.react.modules.appearance.AppearanceModule;
|
|
58
61
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
59
62
|
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
60
63
|
import com.facebook.react.runtime.internal.bolts.Continuation;
|
|
61
64
|
import com.facebook.react.runtime.internal.bolts.Task;
|
|
62
65
|
import com.facebook.react.runtime.internal.bolts.TaskCompletionSource;
|
|
66
|
+
import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
|
|
63
67
|
import com.facebook.react.uimanager.UIManagerModule;
|
|
64
68
|
import com.facebook.react.uimanager.events.BlackHoleEventDispatcher;
|
|
65
69
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
@@ -601,6 +605,20 @@ public class ReactHostImpl implements ReactHost {
|
|
|
601
605
|
return null;
|
|
602
606
|
}
|
|
603
607
|
|
|
608
|
+
/* package */
|
|
609
|
+
@Nullable
|
|
610
|
+
CallInvokerHolder getJSCallInvokerHolder() {
|
|
611
|
+
final ReactInstance reactInstance = mReactInstanceTaskRef.get().getResult();
|
|
612
|
+
if (reactInstance != null) {
|
|
613
|
+
return reactInstance.getJSCallInvokerHolder();
|
|
614
|
+
}
|
|
615
|
+
ReactSoftExceptionLogger.logSoftException(
|
|
616
|
+
TAG,
|
|
617
|
+
new ReactNoCrashSoftException(
|
|
618
|
+
"Tried to get JSCallInvokerHolder while instance is not ready"));
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
|
|
604
622
|
/**
|
|
605
623
|
* To be called when the host activity receives an activity result.
|
|
606
624
|
*
|
|
@@ -632,6 +650,67 @@ public class ReactHostImpl implements ReactHost {
|
|
|
632
650
|
"Tried to access onActivityResult while context is not ready"));
|
|
633
651
|
}
|
|
634
652
|
|
|
653
|
+
/* To be called when focus has changed for the hosting window. */
|
|
654
|
+
@ThreadConfined(UI)
|
|
655
|
+
@Override
|
|
656
|
+
public void onWindowFocusChange(boolean hasFocus) {
|
|
657
|
+
final String method = "onWindowFocusChange(hasFocus = \"" + hasFocus + "\")";
|
|
658
|
+
log(method);
|
|
659
|
+
|
|
660
|
+
ReactContext currentContext = getCurrentReactContext();
|
|
661
|
+
if (currentContext != null) {
|
|
662
|
+
currentContext.onWindowFocusChange(hasFocus);
|
|
663
|
+
}
|
|
664
|
+
ReactSoftExceptionLogger.logSoftException(
|
|
665
|
+
TAG,
|
|
666
|
+
new ReactNoCrashSoftException(
|
|
667
|
+
"Tried to access onWindowFocusChange while context is not ready"));
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/* This method will give JS the opportunity to receive intents via Linking.
|
|
671
|
+
*
|
|
672
|
+
* @param intent The incoming intent
|
|
673
|
+
*/
|
|
674
|
+
@ThreadConfined(UI)
|
|
675
|
+
@Override
|
|
676
|
+
public void onNewIntent(Intent intent) {
|
|
677
|
+
log("onNewIntent()");
|
|
678
|
+
|
|
679
|
+
ReactContext currentContext = getCurrentReactContext();
|
|
680
|
+
if (currentContext != null) {
|
|
681
|
+
String action = intent.getAction();
|
|
682
|
+
Uri uri = intent.getData();
|
|
683
|
+
|
|
684
|
+
if (uri != null
|
|
685
|
+
&& (Intent.ACTION_VIEW.equals(action)
|
|
686
|
+
|| NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action))) {
|
|
687
|
+
DeviceEventManagerModule deviceEventManagerModule =
|
|
688
|
+
currentContext.getNativeModule(DeviceEventManagerModule.class);
|
|
689
|
+
if (deviceEventManagerModule != null) {
|
|
690
|
+
deviceEventManagerModule.emitNewIntentReceived(uri);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
currentContext.onNewIntent(getCurrentActivity(), intent);
|
|
694
|
+
}
|
|
695
|
+
ReactSoftExceptionLogger.logSoftException(
|
|
696
|
+
TAG,
|
|
697
|
+
new ReactNoCrashSoftException("Tried to access onNewIntent while context is not ready"));
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
@ThreadConfined(UI)
|
|
701
|
+
@Override
|
|
702
|
+
public void onConfigurationChanged(Context updatedContext) {
|
|
703
|
+
ReactContext currentReactContext = getCurrentReactContext();
|
|
704
|
+
if (currentReactContext != null) {
|
|
705
|
+
AppearanceModule appearanceModule =
|
|
706
|
+
currentReactContext.getNativeModule(AppearanceModule.class);
|
|
707
|
+
|
|
708
|
+
if (appearanceModule != null) {
|
|
709
|
+
appearanceModule.onConfigurationChanged(updatedContext);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
|
|
635
714
|
@Nullable
|
|
636
715
|
JavaScriptContextHolder getJavaScriptContextHolder() {
|
|
637
716
|
final ReactInstance reactInstance = mReactInstanceTaskRef.get().getResult();
|
|
@@ -475,7 +475,7 @@ final class ReactInstance {
|
|
|
475
475
|
|
|
476
476
|
private native void loadJSBundleFromAssets(AssetManager assetManager, String assetURL);
|
|
477
477
|
|
|
478
|
-
|
|
478
|
+
/* package */ native CallInvokerHolderImpl getJSCallInvokerHolder();
|
|
479
479
|
|
|
480
480
|
private native NativeMethodCallInvokerHolderImpl getNativeMethodCallInvokerHolder();
|
|
481
481
|
|
|
@@ -53,16 +53,32 @@ public final class ViewManagerRegistry implements ComponentCallbacks2 {
|
|
|
53
53
|
* @return the {@link ViewManager} registered to the className received as a parameter
|
|
54
54
|
*/
|
|
55
55
|
public synchronized ViewManager get(String className) {
|
|
56
|
+
// 1. Try to get the manager without the prefix.
|
|
56
57
|
ViewManager viewManager = mViewManagers.get(className);
|
|
57
58
|
if (viewManager != null) {
|
|
58
59
|
return viewManager;
|
|
59
60
|
}
|
|
61
|
+
|
|
62
|
+
// 2. Try to get the manager with the RCT prefix.
|
|
63
|
+
String rctViewManagerName = "RCT" + className;
|
|
64
|
+
viewManager = mViewManagers.get(rctViewManagerName);
|
|
65
|
+
if (viewManager != null) {
|
|
66
|
+
return viewManager;
|
|
67
|
+
}
|
|
60
68
|
if (mViewManagerResolver != null) {
|
|
69
|
+
// 1. Try to get the manager without the prefix.
|
|
61
70
|
viewManager = getViewManagerFromResolver(className);
|
|
62
71
|
if (viewManager != null) return viewManager;
|
|
72
|
+
|
|
73
|
+
// 2. Try to get the manager with the RCT prefix.
|
|
74
|
+
viewManager = getViewManagerFromResolver(rctViewManagerName);
|
|
75
|
+
if (viewManager != null) return viewManager;
|
|
76
|
+
|
|
63
77
|
throw new IllegalViewOperationException(
|
|
64
|
-
"ViewManagerResolver returned null for "
|
|
78
|
+
"ViewManagerResolver returned null for either "
|
|
65
79
|
+ className
|
|
80
|
+
+ " or "
|
|
81
|
+
+ rctViewManagerName
|
|
66
82
|
+ ", existing names are: "
|
|
67
83
|
+ mViewManagerResolver.getViewManagerNames());
|
|
68
84
|
}
|
package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java
CHANGED
|
@@ -807,7 +807,7 @@ public class ReactHorizontalScrollView extends HorizontalScrollView
|
|
|
807
807
|
// more information.
|
|
808
808
|
|
|
809
809
|
if (!mScroller.isFinished() && mScroller.getCurrX() != mScroller.getFinalX()) {
|
|
810
|
-
int scrollRange = computeHorizontalScrollRange() - getWidth();
|
|
810
|
+
int scrollRange = Math.max(computeHorizontalScrollRange() - getWidth(), 0);
|
|
811
811
|
if (scrollX >= scrollRange) {
|
|
812
812
|
mScroller.abortAnimation();
|
|
813
813
|
scrollX = scrollRange;
|
|
@@ -62,6 +62,8 @@ public class TextAttributeProps implements EffectiveTextAttributeProvider {
|
|
|
62
62
|
public static final short TA_KEY_ROLE = 26;
|
|
63
63
|
public static final short TA_KEY_TEXT_TRANSFORM = 27;
|
|
64
64
|
|
|
65
|
+
public static final int UNSET = -1;
|
|
66
|
+
|
|
65
67
|
private static final String PROP_SHADOW_OFFSET = "textShadowOffset";
|
|
66
68
|
private static final String PROP_SHADOW_OFFSET_WIDTH = "width";
|
|
67
69
|
private static final String PROP_SHADOW_OFFSET_HEIGHT = "height";
|
|
@@ -48,10 +48,10 @@ inline static NSURL *NSURLFromImageSource(const facebook::react::ImageSource &im
|
|
|
48
48
|
{
|
|
49
49
|
// `NSURL` has a history of crashing with bad input, so let's be safe.
|
|
50
50
|
@try {
|
|
51
|
-
NSString *urlString = [NSString
|
|
51
|
+
NSString *urlString = [NSString stringWithUTF8String:imageSource.uri.c_str()];
|
|
52
52
|
|
|
53
53
|
if (!imageSource.bundle.empty()) {
|
|
54
|
-
NSString *bundle = [NSString
|
|
54
|
+
NSString *bundle = [NSString stringWithUTF8String:imageSource.bundle.c_str()];
|
|
55
55
|
urlString = [NSString stringWithFormat:@"%@.bundle/%@", bundle, urlString];
|
|
56
56
|
}
|
|
57
57
|
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
#import "RCTInstance.h"
|
|
9
|
-
#import <React/RCTBridgeProxy.h>
|
|
10
9
|
|
|
11
10
|
#import <memory>
|
|
12
11
|
|
|
@@ -16,6 +15,8 @@
|
|
|
16
15
|
#import <React/RCTBridge.h>
|
|
17
16
|
#import <React/RCTBridgeModule.h>
|
|
18
17
|
#import <React/RCTBridgeModuleDecorator.h>
|
|
18
|
+
#import <React/RCTBridgeProxy+Cxx.h>
|
|
19
|
+
#import <React/RCTBridgeProxy.h>
|
|
19
20
|
#import <React/RCTComponentViewFactory.h>
|
|
20
21
|
#import <React/RCTConstants.h>
|
|
21
22
|
#import <React/RCTCxxUtils.h>
|
|
@@ -256,6 +257,7 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
|
|
|
256
257
|
RuntimeExecutor bufferedRuntimeExecutor = _reactInstance->getBufferedRuntimeExecutor();
|
|
257
258
|
timerManager->setRuntimeExecutor(bufferedRuntimeExecutor);
|
|
258
259
|
|
|
260
|
+
auto jsCallInvoker = make_shared<BridgelessJSCallInvoker>(bufferedRuntimeExecutor);
|
|
259
261
|
RCTBridgeProxy *bridgeProxy =
|
|
260
262
|
[[RCTBridgeProxy alloc] initWithViewRegistry:_bridgeModuleDecorator.viewRegistry_DEPRECATED
|
|
261
263
|
moduleRegistry:_bridgeModuleDecorator.moduleRegistry
|
|
@@ -274,14 +276,14 @@ void RCTInstanceSetRuntimeDiagnosticFlags(NSString *flags)
|
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
runtime:_reactInstance->getJavaScriptContext()];
|
|
279
|
+
bridgeProxy.jsCallInvoker = jsCallInvoker;
|
|
277
280
|
[RCTBridge setCurrentBridge:(RCTBridge *)bridgeProxy];
|
|
278
281
|
|
|
279
282
|
// Set up TurboModules
|
|
280
|
-
_turboModuleManager = [[RCTTurboModuleManager alloc]
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
jsInvoker:std::make_shared<BridgelessJSCallInvoker>(bufferedRuntimeExecutor)];
|
|
283
|
+
_turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridgeProxy:bridgeProxy
|
|
284
|
+
bridgeModuleDecorator:_bridgeModuleDecorator
|
|
285
|
+
delegate:self
|
|
286
|
+
jsInvoker:jsCallInvoker];
|
|
285
287
|
_turboModuleManager.runtimeHandler = self;
|
|
286
288
|
|
|
287
289
|
#if RCT_DEV
|