react-native 0.74.0-rc.2 → 0.74.0-rc.4

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.
Files changed (63) hide show
  1. package/Libraries/AppDelegate/RCTAppDelegate.h +5 -8
  2. package/Libraries/AppDelegate/RCTAppDelegate.mm +56 -130
  3. package/Libraries/AppDelegate/RCTRootViewFactory.h +123 -0
  4. package/Libraries/AppDelegate/RCTRootViewFactory.mm +253 -0
  5. package/Libraries/Components/View/ReactNativeStyleAttributes.js +1 -0
  6. package/Libraries/Core/ReactNativeVersion.js +1 -1
  7. package/Libraries/Core/registerCallableModule.d.ts +16 -0
  8. package/Libraries/LogBox/Data/parseLogBoxLog.js +1 -1
  9. package/Libraries/StyleSheet/StyleSheetTypes.d.ts +4 -0
  10. package/Libraries/StyleSheet/StyleSheetTypes.js +3 -0
  11. package/React/Base/RCTBridgeProxy+Cxx.h +20 -0
  12. package/React/Base/RCTBridgeProxy.h +2 -0
  13. package/React/Base/RCTBridgeProxy.mm +15 -0
  14. package/React/Base/RCTConvert.h +3 -0
  15. package/React/Base/RCTConvert.mm +9 -0
  16. package/React/Base/RCTVersion.m +1 -1
  17. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.h +7 -0
  18. package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingView.mm +17 -2
  19. package/React/CoreModules/RCTRedBox.mm +7 -1
  20. package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +32 -0
  21. package/React/Views/RCTCursor.h +13 -0
  22. package/React/Views/RCTView.h +3 -0
  23. package/React/Views/RCTView.m +30 -0
  24. package/React/Views/RCTViewManager.m +2 -0
  25. package/ReactAndroid/api/ReactAndroid.api +44 -0
  26. package/ReactAndroid/build.gradle.kts +26 -0
  27. package/ReactAndroid/cmake-utils/ReactNative-application.cmake +6 -0
  28. package/ReactAndroid/gradle.properties +1 -1
  29. package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +22 -16
  30. package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +9 -0
  31. package/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java +5 -0
  32. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstance.java +1 -1
  33. package/ReactAndroid/src/main/java/com/facebook/react/bridge/CatalystInstanceImpl.java +2 -1
  34. package/ReactAndroid/src/main/java/com/facebook/react/bridge/JSIModuleRegistry.java +2 -2
  35. package/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeArrayInterface.java +1 -1
  36. package/ReactAndroid/src/main/java/com/facebook/react/bridge/queue/MessageQueueThreadHandler.java +0 -11
  37. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactHostDelegate.kt +1 -1
  38. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultReactNativeHost.kt +11 -6
  39. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  40. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +201 -0
  41. package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessReactContext.java +4 -6
  42. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +47 -0
  43. package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +1 -1
  44. package/ReactAndroid/src/main/java/com/facebook/react/views/text/TextAttributeProps.java +2 -0
  45. package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.cpp +0 -1
  46. package/ReactAndroid/src/main/jni/react/jni/JMessageQueueThread.h +0 -4
  47. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  48. package/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +9 -0
  49. package/ReactCommon/react/renderer/components/view/BaseViewProps.h +2 -0
  50. package/ReactCommon/react/renderer/components/view/ViewShadowNode.cpp +1 -1
  51. package/ReactCommon/react/renderer/components/view/conversions.h +22 -0
  52. package/ReactCommon/react/renderer/components/view/primitives.h +2 -0
  53. package/ReactCommon/react/renderer/imagemanager/platform/ios/react/renderer/imagemanager/RCTImagePrimitivesConversions.h +2 -2
  54. package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +45 -12
  55. package/ReactCommon/yoga/yoga/algorithm/AbsoluteLayout.cpp +64 -40
  56. package/ReactCommon/yoga/yoga/algorithm/CalculateLayout.cpp +19 -20
  57. package/package.json +11 -11
  58. package/sdks/hermesc/osx-bin/hermes +0 -0
  59. package/sdks/hermesc/osx-bin/hermesc +0 -0
  60. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
  61. package/template/package.json +5 -5
  62. package/types/index.d.ts +1 -0
  63. package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultBindingsInstaller.kt +0 -20
@@ -9,6 +9,7 @@ package com.facebook.react
9
9
 
10
10
  import android.app.Activity
11
11
  import android.content.Context
12
+ import android.content.Intent
12
13
  import android.os.Bundle
13
14
  import com.facebook.react.bridge.ReactContext
14
15
  import com.facebook.react.bridge.queue.ReactQueueConfiguration
@@ -111,6 +112,14 @@ public interface ReactHost {
111
112
  */
112
113
  public fun destroy(reason: String, ex: Exception?): TaskInterface<Void>
113
114
 
115
+ /* To be called when the host activity receives an activity result. */
116
+ public fun onActivityResult(
117
+ activity: Activity,
118
+ requestCode: Int,
119
+ resultCode: Int,
120
+ data: Intent?,
121
+ )
122
+
114
123
  public fun addBeforeDestroyListener(onBeforeDestroy: () -> Unit)
115
124
 
116
125
  public fun removeBeforeDestroyListener(onBeforeDestroy: () -> Unit)
@@ -998,6 +998,11 @@ public class ReactInstanceManager {
998
998
  if (names != null) {
999
999
  uniqueNames.addAll(names);
1000
1000
  }
1001
+ } else {
1002
+ FLog.w(
1003
+ ReactConstants.TAG,
1004
+ "Package %s is not a ViewManagerOnDemandReactPackage, view managers will not be loaded",
1005
+ reactPackage.getClass().getSimpleName());
1001
1006
  }
1002
1007
  Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
1003
1008
  }
@@ -120,7 +120,7 @@ public interface CatalystInstance
120
120
  RuntimeScheduler getRuntimeScheduler();
121
121
 
122
122
  @Deprecated
123
- void addJSIModules(List<JSIModuleSpec> jsiModules);
123
+ <T extends JSIModule> void addJSIModules(List<JSIModuleSpec<T>> jsiModules);
124
124
 
125
125
  /**
126
126
  * Returns a hybrid object that contains a pointer to a JS CallInvoker, which is used to schedule
@@ -537,7 +537,8 @@ public class CatalystInstanceImpl implements CatalystInstance {
537
537
  public native RuntimeScheduler getRuntimeScheduler();
538
538
 
539
539
  @Override
540
- public void addJSIModules(List<JSIModuleSpec> jsiModules) {
540
+ @Deprecated
541
+ public <T extends JSIModule> void addJSIModules(List<JSIModuleSpec<T>> jsiModules) {
541
542
  mJSIModuleRegistry.registerModules(jsiModules);
542
543
  }
543
544
 
@@ -26,8 +26,8 @@ class JSIModuleRegistry {
26
26
  return Assertions.assertNotNull(jsiModuleHolder.getJSIModule());
27
27
  }
28
28
 
29
- public void registerModules(List<JSIModuleSpec> jsiModules) {
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
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
  package com.facebook.react.bridge;
9
9
 
10
- interface NativeArrayInterface {
10
+ public interface NativeArrayInterface {
11
11
  @Override
12
12
  String toString();
13
13
  }
@@ -10,8 +10,6 @@ package com.facebook.react.bridge.queue;
10
10
  import android.os.Handler;
11
11
  import android.os.Looper;
12
12
  import android.os.Message;
13
- import com.facebook.common.logging.FLog;
14
- import com.facebook.react.common.ReactConstants;
15
13
 
16
14
  /** Handler that can catch and dispatch Exceptions to an Exception handler. */
17
15
  public class MessageQueueThreadHandler extends Handler {
@@ -28,15 +26,6 @@ public class MessageQueueThreadHandler extends Handler {
28
26
  try {
29
27
  super.dispatchMessage(msg);
30
28
  } catch (Exception e) {
31
- if (e instanceof NullPointerException) {
32
- FLog.e(
33
- ReactConstants.TAG,
34
- "Caught NullPointerException when dispatching message in MessageQueueThreadHandler. This is likely caused by runnable"
35
- + "(msg.callback) being nulled in Android Handler after dispatching and before handling (see T170239922 for more details)."
36
- + "Currently we observe that it only happen once which is during initialisation. Due to fixing probably involve Android "
37
- + "System code, we decide to ignore here for now and print an error message for debugging purpose in case this cause more serious issues in future.");
38
- return;
39
- }
40
29
  mExceptionHandler.handleException(e);
41
30
  }
42
31
  }
@@ -43,7 +43,7 @@ public class DefaultReactHostDelegate(
43
43
  override val jsBundleLoader: JSBundleLoader,
44
44
  override val reactPackages: List<ReactPackage> = emptyList(),
45
45
  override val jsRuntimeFactory: JSRuntimeFactory = HermesInstance(),
46
- override val bindingsInstaller: BindingsInstaller = DefaultBindingsInstaller(),
46
+ override val bindingsInstaller: BindingsInstaller? = null,
47
47
  private val reactNativeConfig: ReactNativeConfig = ReactNativeConfig.DEFAULT_CONFIG,
48
48
  private val exceptionHandler: (Exception) -> Unit = {},
49
49
  override val turboModuleManagerDelegateBuilder: ReactPackageTurboModuleManagerDelegate.Builder
@@ -49,13 +49,18 @@ protected constructor(
49
49
  DefaultComponentsRegistry.register(componentFactory)
50
50
 
51
51
  val viewManagerRegistry =
52
- ViewManagerRegistry(
53
- object : ViewManagerResolver {
54
- override fun getViewManager(viewManagerName: String) =
55
- reactInstanceManager.createViewManager(viewManagerName)
52
+ if (lazyViewManagersEnabled) {
53
+ ViewManagerRegistry(
54
+ object : ViewManagerResolver {
55
+ override fun getViewManager(viewManagerName: String) =
56
+ reactInstanceManager.createViewManager(viewManagerName)
56
57
 
57
- override fun getViewManagerNames() = reactInstanceManager.viewManagerNames
58
- })
58
+ override fun getViewManagerNames() = reactInstanceManager.viewManagerNames
59
+ })
60
+ } else {
61
+ ViewManagerRegistry(
62
+ reactInstanceManager.getOrCreateViewManagers(reactApplicationContext))
63
+ }
59
64
 
60
65
  FabricUIManagerProviderImpl(
61
66
  componentFactory, ReactNativeConfig.DEFAULT_CONFIG, viewManagerRegistry)
@@ -18,5 +18,5 @@ public class ReactNativeVersion {
18
18
  "major", 0,
19
19
  "minor", 74,
20
20
  "patch", 0,
21
- "prerelease", "rc.2");
21
+ "prerelease", "rc.4");
22
22
  }
@@ -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
- ReactSoftExceptionLogger.logSoftExceptionVerbose(
86
+ Log.w(
88
87
  TAG,
89
- new ReactNoCrashBridgeNotAllowedSoftException(
90
- "getCatalystInstance() cannot be called when the bridge is disabled"));
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
@@ -15,6 +15,7 @@ import static java.lang.Boolean.TRUE;
15
15
 
16
16
  import android.app.Activity;
17
17
  import android.content.Context;
18
+ import android.content.Intent;
18
19
  import android.os.Bundle;
19
20
  import androidx.annotation.NonNull;
20
21
  import androidx.annotation.Nullable;
@@ -59,6 +60,7 @@ import com.facebook.react.modules.core.DeviceEventManagerModule;
59
60
  import com.facebook.react.runtime.internal.bolts.Continuation;
60
61
  import com.facebook.react.runtime.internal.bolts.Task;
61
62
  import com.facebook.react.runtime.internal.bolts.TaskCompletionSource;
63
+ import com.facebook.react.turbomodule.core.interfaces.CallInvokerHolder;
62
64
  import com.facebook.react.uimanager.UIManagerModule;
63
65
  import com.facebook.react.uimanager.events.BlackHoleEventDispatcher;
64
66
  import com.facebook.react.uimanager.events.EventDispatcher;
@@ -600,6 +602,51 @@ public class ReactHostImpl implements ReactHost {
600
602
  return null;
601
603
  }
602
604
 
605
+ /* package */
606
+ @Nullable
607
+ CallInvokerHolder getJSCallInvokerHolder() {
608
+ final ReactInstance reactInstance = mReactInstanceTaskRef.get().getResult();
609
+ if (reactInstance != null) {
610
+ return reactInstance.getJSCallInvokerHolder();
611
+ }
612
+ ReactSoftExceptionLogger.logSoftException(
613
+ TAG,
614
+ new ReactNoCrashSoftException(
615
+ "Tried to get JSCallInvokerHolder while instance is not ready"));
616
+ return null;
617
+ }
618
+
619
+ /**
620
+ * To be called when the host activity receives an activity result.
621
+ *
622
+ * @param activity The host activity
623
+ */
624
+ @ThreadConfined(UI)
625
+ @Override
626
+ public void onActivityResult(
627
+ Activity activity, int requestCode, int resultCode, @Nullable Intent data) {
628
+ final String method =
629
+ "onActivityResult(activity = \""
630
+ + activity
631
+ + "\", requestCode = \""
632
+ + requestCode
633
+ + "\", resultCode = \""
634
+ + resultCode
635
+ + "\", data = \""
636
+ + data
637
+ + "\")";
638
+ log(method);
639
+
640
+ ReactContext currentContext = getCurrentReactContext();
641
+ if (currentContext != null) {
642
+ currentContext.onActivityResult(activity, requestCode, resultCode, data);
643
+ }
644
+ ReactSoftExceptionLogger.logSoftException(
645
+ TAG,
646
+ new ReactNoCrashSoftException(
647
+ "Tried to access onActivityResult while context is not ready"));
648
+ }
649
+
603
650
  @Nullable
604
651
  JavaScriptContextHolder getJavaScriptContextHolder() {
605
652
  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
- private native CallInvokerHolderImpl getJSCallInvokerHolder();
478
+ /* package */ native CallInvokerHolderImpl getJSCallInvokerHolder();
479
479
 
480
480
  private native NativeMethodCallInvokerHolderImpl getNativeMethodCallInvokerHolder();
481
481
 
@@ -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";
@@ -10,7 +10,6 @@
10
10
  #include <condition_variable>
11
11
  #include <mutex>
12
12
 
13
- #include <fb/log.h>
14
13
  #include <fbjni/NativeRunnable.h>
15
14
  #include <fbjni/fbjni.h>
16
15
  #include <jsi/jsi.h>
@@ -42,10 +42,6 @@ class JMessageQueueThread : public MessageQueueThread {
42
42
  */
43
43
  void quitSynchronous() override;
44
44
 
45
- JavaMessageQueueThread::javaobject jobj() {
46
- return m_jobj.get();
47
- }
48
-
49
45
  private:
50
46
  jni::global_ref<JavaMessageQueueThread::javaobject> m_jobj;
51
47
  };
@@ -18,7 +18,7 @@ constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 74;
20
20
  int32_t Patch = 0;
21
- std::string_view Prerelease = "rc.2";
21
+ std::string_view Prerelease = "rc.4";
22
22
  } ReactNativeVersion;
23
23
 
24
24
  } // namespace facebook::react
@@ -140,6 +140,14 @@ BaseViewProps::BaseViewProps(
140
140
  "shadowRadius",
141
141
  sourceProps.shadowRadius,
142
142
  {})),
143
+ cursor(
144
+ CoreFeatures::enablePropIteratorSetter ? sourceProps.cursor
145
+ : convertRawProp(
146
+ context,
147
+ rawProps,
148
+ "cursor",
149
+ sourceProps.cursor,
150
+ {})),
143
151
  transform(
144
152
  CoreFeatures::enablePropIteratorSetter ? sourceProps.transform
145
153
  : convertRawProp(
@@ -281,6 +289,7 @@ void BaseViewProps::setProp(
281
289
  RAW_SET_PROP_SWITCH_CASE_BASIC(collapsable);
282
290
  RAW_SET_PROP_SWITCH_CASE_BASIC(removeClippedSubviews);
283
291
  RAW_SET_PROP_SWITCH_CASE_BASIC(experimental_layoutConformance);
292
+ RAW_SET_PROP_SWITCH_CASE_BASIC(cursor);
284
293
  // events field
285
294
  VIEW_EVENT_CASE(PointerEnter);
286
295
  VIEW_EVENT_CASE(PointerEnterCapture);
@@ -52,6 +52,8 @@ class BaseViewProps : public YogaStylableProps, public AccessibilityProps {
52
52
  Float shadowOpacity{};
53
53
  Float shadowRadius{3};
54
54
 
55
+ Cursor cursor{};
56
+
55
57
  // Transform
56
58
  Transform transform{};
57
59
  TransformOrigin transformOrigin{};
@@ -60,7 +60,7 @@ void ViewShadowNode::initialize() noexcept {
60
60
  viewProps.accessibilityElementsHidden ||
61
61
  viewProps.accessibilityViewIsModal ||
62
62
  viewProps.importantForAccessibility != ImportantForAccessibility::Auto ||
63
- viewProps.removeClippedSubviews ||
63
+ viewProps.removeClippedSubviews || viewProps.cursor != Cursor::Auto ||
64
64
  HostPlatformViewTraitsInitializer::formsStackingContext(viewProps);
65
65
 
66
66
  bool formsView = formsStackingContext ||
@@ -705,6 +705,28 @@ inline void fromRawValue(
705
705
  react_native_expect(false);
706
706
  }
707
707
 
708
+ inline void fromRawValue(
709
+ const PropsParserContext& context,
710
+ const RawValue& value,
711
+ Cursor& result) {
712
+ result = Cursor::Auto;
713
+ react_native_expect(value.hasType<std::string>());
714
+ if (!value.hasType<std::string>()) {
715
+ return;
716
+ }
717
+ auto stringValue = (std::string)value;
718
+ if (stringValue == "auto") {
719
+ result = Cursor::Auto;
720
+ return;
721
+ }
722
+ if (stringValue == "pointer") {
723
+ result = Cursor::Pointer;
724
+ return;
725
+ }
726
+ LOG(ERROR) << "Could not parse Cursor:" << stringValue;
727
+ react_native_expect(false);
728
+ }
729
+
708
730
  inline void fromRawValue(
709
731
  const PropsParserContext& /*context*/,
710
732
  const RawValue& value,
@@ -91,6 +91,8 @@ enum class BorderCurve : uint8_t { Circular, Continuous };
91
91
 
92
92
  enum class BorderStyle : uint8_t { Solid, Dotted, Dashed };
93
93
 
94
+ enum class Cursor : uint8_t { Auto, Pointer };
95
+
94
96
  enum class LayoutConformance : uint8_t { Undefined, Classic, Strict };
95
97
 
96
98
  template <typename T>
@@ -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 stringWithCString:imageSource.uri.c_str() encoding:NSASCIIStringEncoding];
51
+ NSString *urlString = [NSString stringWithUTF8String:imageSource.uri.c_str()];
52
52
 
53
53
  if (!imageSource.bundle.empty()) {
54
- NSString *bundle = [NSString stringWithCString:imageSource.bundle.c_str() encoding:NSASCIIStringEncoding];
54
+ NSString *bundle = [NSString stringWithUTF8String:imageSource.bundle.c_str()];
55
55
  urlString = [NSString stringWithFormat:@"%@.bundle/%@", bundle, urlString];
56
56
  }
57
57