react-native 0.75.0 → 0.75.1

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.
@@ -16,7 +16,7 @@ const version: $ReadOnly<{
16
16
  }> = {
17
17
  major: 0,
18
18
  minor: 75,
19
- patch: 0,
19
+ patch: 1,
20
20
  prerelease: null,
21
21
  };
22
22
 
@@ -23,7 +23,7 @@ NSDictionary* RCTGetReactNativeVersion(void)
23
23
  __rnVersion = @{
24
24
  RCTVersionMajor: @(0),
25
25
  RCTVersionMinor: @(75),
26
- RCTVersionPatch: @(0),
26
+ RCTVersionPatch: @(1),
27
27
  RCTVersionPrerelease: [NSNull null],
28
28
  };
29
29
  });
@@ -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 {
@@ -1,4 +1,4 @@
1
- VERSION_NAME=0.75.0
1
+ VERSION_NAME=0.75.1
2
2
  react.internal.publishingGroup=com.facebook.react
3
3
 
4
4
  android.useAndroidX=true
@@ -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", 1,
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
  *
@@ -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
 
@@ -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 = 1;
21
21
  std::string_view Prerelease = "";
22
22
  } ReactNativeVersion;
23
23
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native",
3
- "version": "0.75.0",
3
+ "version": "0.75.1",
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.1",
116
+ "@react-native/codegen": "0.75.1",
117
+ "@react-native/community-cli-plugin": "0.75.1",
118
+ "@react-native/gradle-plugin": "0.75.1",
119
+ "@react-native/js-polyfills": "0.75.1",
120
+ "@react-native/normalize-colors": "0.75.1",
121
+ "@react-native/virtualized-lists": "0.75.1",
122
122
  "abort-controller": "^3.0.0",
123
123
  "anser": "^1.4.9",
124
124
  "ansi-regex": "^5.0.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