react-native 0.75.0 → 0.75.2

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 (29) hide show
  1. package/Libraries/Core/ReactNativeVersion.js +1 -1
  2. package/Libraries/Text/TextInput/RCTBaseTextInputView.mm +0 -3
  3. package/React/Base/RCTVersion.m +1 -1
  4. package/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +0 -3
  5. package/ReactAndroid/api/ReactAndroid.api +3 -1
  6. package/ReactAndroid/gradle.properties +1 -1
  7. package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +2 -2
  8. package/ReactAndroid/src/main/java/com/facebook/react/bridge/DynamicNative.kt +51 -0
  9. package/ReactAndroid/src/main/java/com/facebook/react/internal/turbomodule/core/TurboModuleInteropUtils.java +2 -5
  10. package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
  11. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/BaseViewManager.java +6 -1
  12. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/LengthPercentage.kt +1 -1
  13. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/TransformHelper.java +40 -11
  14. package/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.kt +8 -0
  15. package/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper/ImageSource.kt +1 -1
  16. package/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java +11 -1
  17. package/ReactAndroid/src/main/jni/react/jni/JDynamicNative.cpp +46 -0
  18. package/ReactAndroid/src/main/jni/react/jni/JDynamicNative.h +56 -0
  19. package/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +2 -0
  20. package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
  21. package/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.cpp +8 -1
  22. package/ReactCommon/react/nativemodule/samples/platform/android/SampleLegacyModule.java +40 -0
  23. package/package.json +8 -8
  24. package/scripts/cocoapods/utils.rb +1 -1
  25. package/sdks/.hermesversion +1 -1
  26. package/sdks/hermesc/linux64-bin/hermesc +0 -0
  27. package/sdks/hermesc/osx-bin/hermes +0 -0
  28. package/sdks/hermesc/osx-bin/hermesc +0 -0
  29. package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 75,
19
- patch: 0,
19
+ patch: 2,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -651,8 +651,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
651
651
  - (NSString *)returnKeyTypeToString:(UIReturnKeyType)returnKeyType
652
652
  {
653
653
  switch (returnKeyType) {
654
- case UIReturnKeyDefault:
655
- return @"Default";
656
654
  case UIReturnKeyGo:
657
655
  return @"Go";
658
656
  case UIReturnKeyNext:
@@ -680,7 +678,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame)
680
678
  {
681
679
  returnKeyTypesSet = [NSSet setWithObjects:@(UIReturnKeyDone),
682
680
  @(UIReturnKeyGo),
683
- @(UIReturnKeyDefault),
684
681
  @(UIReturnKeyNext),
685
682
  @(UIReturnKeySearch),
686
683
  @(UIReturnKeySend),
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(75),
26
- RCTVersionPatch: @(0),
26
+ RCTVersionPatch: @(2),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -471,8 +471,6 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
471
471
  - (NSString *)returnKeyTypeToString:(UIReturnKeyType)returnKeyType
472
472
  {
473
473
  switch (returnKeyType) {
474
- case UIReturnKeyDefault:
475
- return @"Default";
476
474
  case UIReturnKeyGo:
477
475
  return @"Go";
478
476
  case UIReturnKeyNext:
@@ -500,7 +498,6 @@ static NSSet<NSNumber *> *returnKeyTypesSet;
500
498
  {
501
499
  returnKeyTypesSet = [NSSet setWithObjects:@(UIReturnKeyDone),
502
500
  @(UIReturnKeyGo),
503
- @(UIReturnKeyDefault),
504
501
  @(UIReturnKeyNext),
505
502
  @(UIReturnKeySearch),
506
503
  @(UIReturnKeySend),
@@ -4219,6 +4219,7 @@ public final class com/facebook/react/uimanager/LengthPercentage {
4219
4219
  public static final field Companion Lcom/facebook/react/uimanager/LengthPercentage$Companion;
4220
4220
  public fun <init> ()V
4221
4221
  public fun <init> (FLcom/facebook/react/uimanager/LengthPercentageType;)V
4222
+ public final fun getUnit ()Lcom/facebook/react/uimanager/LengthPercentageType;
4222
4223
  public final fun resolve (FF)F
4223
4224
  public static final fun setFromDynamic (Lcom/facebook/react/bridge/Dynamic;)Lcom/facebook/react/uimanager/LengthPercentage;
4224
4225
  }
@@ -5022,6 +5023,7 @@ public class com/facebook/react/uimanager/TransformHelper {
5022
5023
  public fun <init> ()V
5023
5024
  public static fun processTransform (Lcom/facebook/react/bridge/ReadableArray;[D)V
5024
5025
  public static fun processTransform (Lcom/facebook/react/bridge/ReadableArray;[DFFLcom/facebook/react/bridge/ReadableArray;)V
5026
+ public static fun processTransform (Lcom/facebook/react/bridge/ReadableArray;[DFFLcom/facebook/react/bridge/ReadableArray;Z)V
5025
5027
  }
5026
5028
 
5027
5029
  public abstract interface class com/facebook/react/uimanager/UIBlock {
@@ -6447,7 +6449,7 @@ public class com/facebook/react/views/image/ReactImageView : com/facebook/drawee
6447
6449
  public fun updateCallerContext (Ljava/lang/Object;)V
6448
6450
  }
6449
6451
 
6450
- public final class com/facebook/react/views/imagehelper/ImageSource {
6452
+ public class com/facebook/react/views/imagehelper/ImageSource {
6451
6453
  public static final field Companion Lcom/facebook/react/views/imagehelper/ImageSource$Companion;
6452
6454
  public fun <init> (Landroid/content/Context;Ljava/lang/String;)V
6453
6455
  public fun <init> (Landroid/content/Context;Ljava/lang/String;D)V
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.75.0
1
+ VERSION_NAME=0.75.2
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -891,7 +891,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
891
891
  sendEvent(
892
892
  "keyboardDidHide",
893
893
  createKeyboardEventPayload(
894
- PixelUtil.toDIPFromPixel(mLastHeight),
894
+ PixelUtil.toDIPFromPixel(mVisibleViewArea.height()),
895
895
  0,
896
896
  PixelUtil.toDIPFromPixel(mVisibleViewArea.width()),
897
897
  0));
@@ -940,7 +940,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
940
940
  sendEvent(
941
941
  "keyboardDidHide",
942
942
  createKeyboardEventPayload(
943
- PixelUtil.toDIPFromPixel(mLastHeight),
943
+ PixelUtil.toDIPFromPixel(mVisibleViewArea.height()),
944
944
  0,
945
945
  PixelUtil.toDIPFromPixel(mVisibleViewArea.width()),
946
946
  0));
@@ -0,0 +1,51 @@
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.bridge
9
+
10
+ import com.facebook.jni.HybridData
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import com.facebook.proguard.annotations.DoNotStripAny
13
+
14
+ /**
15
+ * An implementation of [Dynamic] that has a C++ implementation.
16
+ *
17
+ * This is used to support Legacy Native Modules that have not been migrated to the new architecture
18
+ * and are using [Dynamic] as a parameter type.
19
+ */
20
+ @DoNotStripAny
21
+ private class DynamicNative(
22
+ @Suppress("NoHungarianNotation") @field:DoNotStrip private val mHybridData: HybridData?
23
+ ) : Dynamic {
24
+
25
+ override val type: ReadableType
26
+ get() = getTypeNative()
27
+
28
+ override val isNull: Boolean
29
+ get() = isNullNative()
30
+
31
+ private external fun getTypeNative(): ReadableType
32
+
33
+ private external fun isNullNative(): Boolean
34
+
35
+ external override fun asBoolean(): Boolean
36
+
37
+ // The native representation is holding the value as Double. We do the Int conversion here.
38
+ override fun asInt(): Int = asDouble().toInt()
39
+
40
+ external override fun asDouble(): Double
41
+
42
+ external override fun asString(): String
43
+
44
+ external override fun asArray(): ReadableArray
45
+
46
+ external override fun asMap(): ReadableMap
47
+
48
+ override fun recycle() {
49
+ // Noop - nothing to recycle since there is no pooling
50
+ }
51
+ }
@@ -161,14 +161,11 @@ class TurboModuleInteropUtils {
161
161
  || paramClass == Callback.class
162
162
  || paramClass == Promise.class
163
163
  || paramClass == ReadableMap.class
164
- || paramClass == ReadableArray.class) {
164
+ || paramClass == ReadableArray.class
165
+ || paramClass == Dynamic.class) {
165
166
  return convertClassToJniType(paramClass);
166
167
  }
167
168
 
168
- if (paramClass == Dynamic.class) {
169
- // TODO(T145105887): Output warnings that TurboModules doesn't yet support Dynamic arguments
170
- }
171
-
172
169
  throw new ParsingException(
173
170
  moduleName,
174
171
  methodName,
@@ -17,6 +17,6 @@ public class ReactNativeVersion {
17
17
  public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
18
18
  "major", 0,
19
19
  "minor", 75,
20
- "patch", 0,
20
+ "patch", 2,
21
21
  "prerelease", null);
22
22
  }
@@ -29,6 +29,8 @@ import com.facebook.react.common.MapBuilder;
29
29
  import com.facebook.react.common.ReactConstants;
30
30
  import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole;
31
31
  import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role;
32
+ import com.facebook.react.uimanager.common.UIManagerType;
33
+ import com.facebook.react.uimanager.common.ViewUtil;
32
34
  import com.facebook.react.uimanager.annotations.ReactProp;
33
35
  import com.facebook.react.uimanager.events.PointerEventHelper;
34
36
  import com.facebook.react.uimanager.util.ReactFindViewUtil;
@@ -535,13 +537,16 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
535
537
  return;
536
538
  }
537
539
 
540
+ boolean allowPercentageResolution = ViewUtil.getUIManagerType(view) == UIManagerType.FABRIC;
541
+
538
542
  sMatrixDecompositionContext.reset();
539
543
  TransformHelper.processTransform(
540
544
  transforms,
541
545
  sTransformDecompositionArray,
542
546
  PixelUtil.toDIPFromPixel(view.getWidth()),
543
547
  PixelUtil.toDIPFromPixel(view.getHeight()),
544
- transformOrigin);
548
+ transformOrigin,
549
+ allowPercentageResolution);
545
550
  MatrixMathHelper.decomposeMatrix(sTransformDecompositionArray, sMatrixDecompositionContext);
546
551
  view.setTranslationX(
547
552
  PixelUtil.toPixelFromDIP(
@@ -20,7 +20,7 @@ public enum class LengthPercentageType {
20
20
 
21
21
  public class LengthPercentage(
22
22
  private val value: Float,
23
- private val unit: LengthPercentageType,
23
+ public val unit: LengthPercentageType,
24
24
  ) {
25
25
  public companion object {
26
26
  @JvmStatic
@@ -45,19 +45,41 @@ public class TransformHelper {
45
45
  return inRadians ? value : MatrixMathHelper.degreesToRadians(value);
46
46
  }
47
47
 
48
+ /**
49
+ * @deprecated Use {@link #processTransform(ReadableArray, double[], float, float, ReadableArray,
50
+ * boolean)} instead.
51
+ */
52
+ @Deprecated(forRemoval = true, since = "0.75")
48
53
  public static void processTransform(ReadableArray transforms, double[] result) {
49
- processTransform(transforms, result, 0, 0, null);
54
+ processTransform(transforms, result, 0, 0, null, false);
50
55
  }
51
56
 
57
+ /**
58
+ * @deprecated Use {@link #processTransform(ReadableArray, double[], float, float, ReadableArray,
59
+ * boolean)} instead.
60
+ */
61
+ @Deprecated(forRemoval = true, since = "0.75")
52
62
  public static void processTransform(
53
63
  ReadableArray transforms,
54
64
  double[] result,
55
65
  float viewWidth,
56
66
  float viewHeight,
57
67
  ReadableArray transformOrigin) {
68
+ processTransform(transforms, result, viewWidth, viewHeight, transformOrigin, false);
69
+ }
70
+
71
+ public static void processTransform(
72
+ ReadableArray transforms,
73
+ double[] result,
74
+ float viewWidth,
75
+ float viewHeight,
76
+ ReadableArray transformOrigin,
77
+ boolean allowPercentageResolution) {
58
78
  double[] helperMatrix = sHelperMatrix.get();
59
79
  MatrixMathHelper.resetIdentityMatrix(result);
60
- float[] offsets = getTranslateForTransformOrigin(viewWidth, viewHeight, transformOrigin);
80
+ float[] offsets =
81
+ getTranslateForTransformOrigin(
82
+ viewWidth, viewHeight, transformOrigin, allowPercentageResolution);
61
83
 
62
84
  if (offsets != null) {
63
85
  MatrixMathHelper.resetIdentityMatrix(helperMatrix);
@@ -104,13 +126,13 @@ public class TransformHelper {
104
126
  } else if ("translate".equals(transformType)) {
105
127
  ReadableArray value = transform.getArray(transformType);
106
128
  double x = 0;
107
- if (value.getType(0) == ReadableType.String) {
129
+ if (value.getType(0) == ReadableType.String && allowPercentageResolution) {
108
130
  x = parseTranslateValue(value.getString(0), viewWidth);
109
131
  } else {
110
132
  x = value.getDouble(0);
111
133
  }
112
134
  double y = 0;
113
- if (value.getType(1) == ReadableType.String) {
135
+ if (value.getType(1) == ReadableType.String && allowPercentageResolution) {
114
136
  y = parseTranslateValue(value.getString(1), viewHeight);
115
137
  } else {
116
138
  y = value.getDouble(1);
@@ -119,7 +141,8 @@ public class TransformHelper {
119
141
  MatrixMathHelper.applyTranslate3D(helperMatrix, x, y, z);
120
142
  } else if ("translateX".equals(transformType)) {
121
143
  double translateValue = 0;
122
- if (transform.getType(transformType) == ReadableType.String) {
144
+ if (transform.getType(transformType) == ReadableType.String
145
+ && allowPercentageResolution) {
123
146
  translateValue = parseTranslateValue(transform.getString(transformType), viewWidth);
124
147
  } else {
125
148
  translateValue = transform.getDouble(transformType);
@@ -127,7 +150,8 @@ public class TransformHelper {
127
150
  MatrixMathHelper.applyTranslate2D(helperMatrix, translateValue, 0d);
128
151
  } else if ("translateY".equals(transformType)) {
129
152
  double translateValue = 0;
130
- if (transform.getType(transformType) == ReadableType.String) {
153
+ if (transform.getType(transformType) == ReadableType.String
154
+ && allowPercentageResolution) {
131
155
  translateValue = parseTranslateValue(transform.getString(transformType), viewHeight);
132
156
  } else {
133
157
  translateValue = transform.getDouble(transformType);
@@ -167,7 +191,10 @@ public class TransformHelper {
167
191
  }
168
192
 
169
193
  private static float[] getTranslateForTransformOrigin(
170
- float viewWidth, float viewHeight, ReadableArray transformOrigin) {
194
+ float viewWidth,
195
+ float viewHeight,
196
+ ReadableArray transformOrigin,
197
+ boolean allowPercentageResolution) {
171
198
  if (transformOrigin == null || (viewHeight == 0 && viewWidth == 0)) {
172
199
  return null;
173
200
  }
@@ -183,10 +210,12 @@ public class TransformHelper {
183
210
  break;
184
211
  case String:
185
212
  {
186
- String part = transformOrigin.getString(i);
187
- if (part.endsWith("%")) {
188
- float val = Float.parseFloat(part.substring(0, part.length() - 1));
189
- origin[i] = (i == 0 ? viewWidth : viewHeight) * val / 100.0f;
213
+ if (allowPercentageResolution) {
214
+ String part = transformOrigin.getString(i);
215
+ if (part.endsWith("%")) {
216
+ float val = Float.parseFloat(part.substring(0, part.length() - 1));
217
+ origin[i] = (i == 0 ? viewWidth : viewHeight) * val / 100.0f;
218
+ }
190
219
  }
191
220
  break;
192
221
  }
@@ -7,6 +7,8 @@
7
7
 
8
8
  package com.facebook.react.uimanager.common
9
9
 
10
+ import android.view.View
11
+
10
12
  public object ViewUtil {
11
13
 
12
14
  public const val NO_SURFACE_ID: Int = -1
@@ -26,6 +28,12 @@ public object ViewUtil {
26
28
  UIManagerType.DEFAULT
27
29
  }
28
30
 
31
+ /**
32
+ * Overload for {@link #getUIManagerType(int)} that uses the view's id to determine if it
33
+ * originated from Fabric
34
+ */
35
+ @JvmStatic @UIManagerType public fun getUIManagerType(view: View): Int = getUIManagerType(view.id)
36
+
29
37
  /**
30
38
  * Version of getUIManagerType that uses both surfaceId and viewTag heuristics
31
39
  *
@@ -12,7 +12,7 @@ import android.net.Uri
12
12
  import java.util.Objects
13
13
 
14
14
  /** Class describing an image source (network URI or resource) and size. */
15
- public class ImageSource
15
+ public open class ImageSource
16
16
  @JvmOverloads
17
17
  constructor(
18
18
  context: Context,
@@ -23,6 +23,7 @@ import com.facebook.react.common.ReactConstants;
23
23
  import com.facebook.react.common.annotations.VisibleForTesting;
24
24
  import com.facebook.react.module.annotations.ReactModule;
25
25
  import com.facebook.react.uimanager.LengthPercentage;
26
+ import com.facebook.react.uimanager.LengthPercentageType;
26
27
  import com.facebook.react.uimanager.PixelUtil;
27
28
  import com.facebook.react.uimanager.PointerEvents;
28
29
  import com.facebook.react.uimanager.Spacing;
@@ -31,6 +32,8 @@ import com.facebook.react.uimanager.UIManagerHelper;
31
32
  import com.facebook.react.uimanager.ViewProps;
32
33
  import com.facebook.react.uimanager.annotations.ReactProp;
33
34
  import com.facebook.react.uimanager.annotations.ReactPropGroup;
35
+ import com.facebook.react.uimanager.common.UIManagerType;
36
+ import com.facebook.react.uimanager.common.ViewUtil;
34
37
  import com.facebook.react.uimanager.events.EventDispatcher;
35
38
  import com.facebook.react.uimanager.style.BorderRadiusProp;
36
39
  import com.facebook.yoga.YogaConstants;
@@ -131,9 +134,16 @@ public class ReactViewManager extends ReactClippingViewManager<ReactViewGroup> {
131
134
  ViewProps.BORDER_START_START_RADIUS,
132
135
  })
133
136
  public void setBorderRadius(ReactViewGroup view, int index, Dynamic rawBorderRadius) {
134
-
135
137
  @Nullable LengthPercentage borderRadius = LengthPercentage.setFromDynamic(rawBorderRadius);
136
138
 
139
+ // We do not support percentage border radii on Paper in order to be consistent with iOS (to
140
+ // avoid developer surprise if it works on one platform but not another).
141
+ if (ViewUtil.getUIManagerType(view) != UIManagerType.FABRIC
142
+ && borderRadius != null
143
+ && borderRadius.getUnit() == LengthPercentageType.PERCENT) {
144
+ borderRadius = null;
145
+ }
146
+
137
147
  view.setBorderRadius(BorderRadiusProp.values()[index], borderRadius);
138
148
  }
139
149
 
@@ -0,0 +1,46 @@
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
+ #include "JDynamicNative.h"
9
+ #include "ReadableNativeArray.h"
10
+ #include "ReadableNativeMap.h"
11
+
12
+ using namespace facebook::jni;
13
+
14
+ namespace facebook::react {
15
+
16
+ jboolean JDynamicNative::isNullNative() {
17
+ return payload_.isNull();
18
+ }
19
+
20
+ jni::local_ref<ReadableType> JDynamicNative::getTypeNative() {
21
+ return ReadableType::getType(payload_.type());
22
+ }
23
+
24
+ jni::local_ref<jstring> JDynamicNative::asString() {
25
+ return jni::make_jstring(payload_.asString());
26
+ }
27
+
28
+ jboolean JDynamicNative::asBoolean() {
29
+ return payload_.asBool();
30
+ }
31
+
32
+ jdouble JDynamicNative::asDouble() {
33
+ return payload_.asDouble();
34
+ }
35
+
36
+ jni::local_ref<ReadableArray> JDynamicNative::asArray() {
37
+ return jni::adopt_local(reinterpret_cast<ReadableArray::javaobject>(
38
+ ReadableNativeArray::newObjectCxxArgs(payload_).release()));
39
+ }
40
+
41
+ jni::local_ref<ReadableMap> JDynamicNative::asMap() {
42
+ return jni::adopt_local(reinterpret_cast<ReadableMap::javaobject>(
43
+ ReadableNativeMap::createWithContents(std::move(payload_)).release()));
44
+ }
45
+
46
+ } // namespace facebook::react
@@ -0,0 +1,56 @@
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
+ #pragma once
9
+
10
+ #include "NativeCommon.h"
11
+ #include "ReadableNativeArray.h"
12
+ #include "ReadableNativeMap.h"
13
+
14
+ #include <fbjni/fbjni.h>
15
+ #include <folly/dynamic.h>
16
+ #include <folly/json.h>
17
+
18
+ namespace facebook::react {
19
+
20
+ struct JDynamic : public jni::JavaClass<JDynamic> {
21
+ constexpr static auto kJavaDescriptor = "Lcom/facebook/react/bridge/Dynamic;";
22
+ };
23
+
24
+ class JDynamicNative : public jni::HybridClass<JDynamicNative, JDynamic> {
25
+ public:
26
+ constexpr static auto kJavaDescriptor =
27
+ "Lcom/facebook/react/bridge/DynamicNative;";
28
+
29
+ JDynamicNative(folly::dynamic payload) : payload_(std::move(payload)) {}
30
+
31
+ static void registerNatives() {
32
+ javaClassStatic()->registerNatives(
33
+ {makeNativeMethod("isNullNative", JDynamicNative::isNullNative),
34
+ makeNativeMethod("getTypeNative", JDynamicNative::getTypeNative),
35
+ makeNativeMethod("asDouble", JDynamicNative::asDouble),
36
+ makeNativeMethod("asBoolean", JDynamicNative::asBoolean),
37
+ makeNativeMethod("asString", JDynamicNative::asString),
38
+ makeNativeMethod("asArray", JDynamicNative::asArray),
39
+ makeNativeMethod("asMap", JDynamicNative::asMap)});
40
+ }
41
+
42
+ private:
43
+ friend HybridBase;
44
+
45
+ jni::local_ref<ReadableType> getTypeNative();
46
+ jni::local_ref<jstring> asString();
47
+ jboolean asBoolean();
48
+ jdouble asDouble();
49
+ jboolean isNullNative();
50
+ jni::local_ref<ReadableArray> asArray();
51
+ jni::local_ref<ReadableMap> asMap();
52
+
53
+ folly::dynamic payload_;
54
+ };
55
+
56
+ } // namespace facebook::react
@@ -15,6 +15,7 @@
15
15
  #include "CatalystInstanceImpl.h"
16
16
  #include "CxxModuleWrapperBase.h"
17
17
  #include "JCallback.h"
18
+ #include "JDynamicNative.h"
18
19
  #include "JInspector.h"
19
20
  #include "JReactMarker.h"
20
21
  #include "JavaScriptExecutorHolder.h"
@@ -89,6 +90,7 @@ extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
89
90
  NativeMap::registerNatives();
90
91
  ReadableNativeMap::registerNatives();
91
92
  WritableNativeMap::registerNatives();
93
+ JDynamicNative::registerNatives();
92
94
  JReactMarker::registerNatives();
93
95
  JInspector::registerNatives();
94
96
  ReactInstanceManagerInspectorTarget::registerNatives();
@@ -17,7 +17,7 @@ namespace facebook::react {
17
17
  constexpr struct {
18
18
  int32_t Major = 0;
19
19
  int32_t Minor = 75;
20
- int32_t Patch = 0;
20
+ int32_t Patch = 2;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
@@ -19,6 +19,7 @@
19
19
  #include <jsi/JSIDynamic.h>
20
20
  #include <react/bridging/Bridging.h>
21
21
  #include <react/debug/react_native_assert.h>
22
+ #include <react/jni/JDynamicNative.h>
22
23
  #include <react/jni/NativeMap.h>
23
24
  #include <react/jni/ReadableNativeMap.h>
24
25
  #include <react/jni/WritableNativeMap.h>
@@ -373,7 +374,9 @@ JNIArgs convertJSIArgsToJNIArgs(
373
374
  continue;
374
375
  }
375
376
 
376
- if (arg->isNull() || arg->isUndefined()) {
377
+ // Dynamic encapsulates the Null type so we don't want to return null here.
378
+ if ((arg->isNull() && type != "Lcom/facebook/react/bridge/Dynamic;") ||
379
+ arg->isUndefined()) {
377
380
  jarg->l = nullptr;
378
381
  } else if (type == "Ljava/lang/Double;") {
379
382
  if (!arg->isNumber()) {
@@ -436,6 +439,10 @@ JNIArgs convertJSIArgsToJNIArgs(
436
439
  auto jParams =
437
440
  ReadableNativeMap::createWithContents(std::move(dynamicFromValue));
438
441
  jarg->l = makeGlobalIfNecessary(jParams.release());
442
+ } else if (type == "Lcom/facebook/react/bridge/Dynamic;") {
443
+ auto dynamicFromValue = jsi::dynamicFromValue(rt, *arg);
444
+ auto jParams = JDynamicNative::newObjectCxxArgs(dynamicFromValue);
445
+ jarg->l = makeGlobalIfNecessary(jParams.release());
439
446
  } else {
440
447
  throw JavaTurboModuleInvalidArgumentTypeException(
441
448
  type, argIndex, methodName);
@@ -13,12 +13,14 @@ import android.widget.Toast;
13
13
  import com.facebook.proguard.annotations.DoNotStrip;
14
14
  import com.facebook.react.bridge.Arguments;
15
15
  import com.facebook.react.bridge.Callback;
16
+ import com.facebook.react.bridge.Dynamic;
16
17
  import com.facebook.react.bridge.Promise;
17
18
  import com.facebook.react.bridge.ReactApplicationContext;
18
19
  import com.facebook.react.bridge.ReactContextBaseJavaModule;
19
20
  import com.facebook.react.bridge.ReactMethod;
20
21
  import com.facebook.react.bridge.ReadableArray;
21
22
  import com.facebook.react.bridge.ReadableMap;
23
+ import com.facebook.react.bridge.ReadableType;
22
24
  import com.facebook.react.bridge.WritableArray;
23
25
  import com.facebook.react.bridge.WritableMap;
24
26
  import com.facebook.react.bridge.WritableNativeArray;
@@ -155,6 +157,44 @@ public class SampleLegacyModule extends ReactContextBaseJavaModule {
155
157
  return map;
156
158
  }
157
159
 
160
+ @SuppressWarnings("unused")
161
+ @ReactMethod(isBlockingSynchronousMethod = true)
162
+ public WritableMap getDynamic(Dynamic dynamic) {
163
+ WritableNativeMap resultMap = new WritableNativeMap();
164
+ ReadableType type = dynamic.getType();
165
+ if (type == ReadableType.Null) {
166
+ log("getDynamic as Null", dynamic, dynamic);
167
+ resultMap.putString("type", "Null");
168
+ resultMap.putNull("value");
169
+ } else if (type == ReadableType.Boolean) {
170
+ boolean result = dynamic.asBoolean();
171
+ log("getDynamic as Boolean", dynamic, result);
172
+ resultMap.putString("type", "Boolean");
173
+ resultMap.putBoolean("value", result);
174
+ } else if (type == ReadableType.Number) {
175
+ int result = dynamic.asInt();
176
+ log("getDynamic as Number", dynamic, result);
177
+ resultMap.putString("type", "Number");
178
+ resultMap.putInt("value", result);
179
+ } else if (type == ReadableType.String) {
180
+ String result = dynamic.asString();
181
+ log("getDynamic as String", dynamic, result);
182
+ resultMap.putString("type", "String");
183
+ resultMap.putString("value", result);
184
+ } else if (type == ReadableType.Array) {
185
+ ReadableArray result = dynamic.asArray();
186
+ log("getDynamic as Array", dynamic, result);
187
+ resultMap.putString("type", "Array");
188
+ resultMap.putArray("value", result);
189
+ } else if (type == ReadableType.Map) {
190
+ ReadableMap result = dynamic.asMap();
191
+ log("getDynamic as Map", dynamic, result);
192
+ resultMap.putString("type", "Map");
193
+ resultMap.putMap("value", result);
194
+ }
195
+ return resultMap;
196
+ }
197
+
158
198
  @DoNotStrip
159
199
  @SuppressWarnings("unused")
160
200
  @ReactMethod(isBlockingSynchronousMethod = true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.75.0",
3
+ "version": "0.75.2",
4
4
  "description": "A framework for building native apps using React",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -112,13 +112,13 @@
112
112
  "@react-native-community/cli": "14.0.0",
113
113
  "@react-native-community/cli-platform-android": "14.0.0",
114
114
  "@react-native-community/cli-platform-ios": "14.0.0",
115
- "@react-native/assets-registry": "0.75.0",
116
- "@react-native/codegen": "0.75.0",
117
- "@react-native/community-cli-plugin": "0.75.0",
118
- "@react-native/gradle-plugin": "0.75.0",
119
- "@react-native/js-polyfills": "0.75.0",
120
- "@react-native/normalize-colors": "0.75.0",
121
- "@react-native/virtualized-lists": "0.75.0",
115
+ "@react-native/assets-registry": "0.75.2",
116
+ "@react-native/codegen": "0.75.2",
117
+ "@react-native/community-cli-plugin": "0.75.2",
118
+ "@react-native/gradle-plugin": "0.75.2",
119
+ "@react-native/js-polyfills": "0.75.2",
120
+ "@react-native/normalize-colors": "0.75.2",
121
+ "@react-native/virtualized-lists": "0.75.2",
122
122
  "abort-controller": "^3.0.0",
123
123
  "anser": "^1.4.9",
124
124
  "ansi-regex": "^5.0.0",
@@ -241,7 +241,7 @@ class ReactNativePodsUtils
241
241
  node_binary = `type -a node`.split("\n").map { |path|
242
242
  path.gsub!("node is ", "")
243
243
  }.select { |b|
244
- return !b.start_with?("/var")
244
+ !b.start_with?("/var")
245
245
  }
246
246
 
247
247
  node_binary = node_binary[0]
@@ -1 +1 @@
1
- hermes-2024-07-01-RNv0.75.0-1edbe36ce92fef2c4d427f5c4e104f2758f4b692
1
+ hermes-2024-08-15-RNv0.75.1-4b3bf912cc0f705b51b71ce1a5b8bd79b93a451b
Binary file
Binary file
Binary file
Binary file