Skip to content

Commit bbd5b5e

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Gate off % border radii on Android Paper (#45945)
Summary: Pull Request resolved: #45945 This code is forked on iOS, where we have been, as a policy, avoiding Paper-specific changes. This code is shared between renderers on Android, but it is confusing developer experience to have it work on Android Paper, to then fail on iOS unless it is on new arch. This change disables support on Android Paper for consistency. Changelog: [Android][Removed] - Gate off % border radii on Android Paper Reviewed By: cortinico Differential Revision: D60967347 fbshipit-source-id: 1d26bc71aee677aa9a0dc9bb38f781a99c7762a8
1 parent 757cefb commit bbd5b5e

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

packages/react-native/ReactAndroid/api/ReactAndroid.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4369,6 +4369,7 @@ public final class com/facebook/react/uimanager/LengthPercentage {
43694369
public static final field Companion Lcom/facebook/react/uimanager/LengthPercentage$Companion;
43704370
public fun <init> ()V
43714371
public fun <init> (FLcom/facebook/react/uimanager/LengthPercentageType;)V
4372+
public final fun getUnit ()Lcom/facebook/react/uimanager/LengthPercentageType;
43724373
public final fun resolve (FF)F
43734374
public static final fun setFromDynamic (Lcom/facebook/react/bridge/Dynamic;)Lcom/facebook/react/uimanager/LengthPercentage;
43744375
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/LengthPercentage.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public enum class LengthPercentageType {
2020

2121
public class LengthPercentage(
2222
private val value: Float,
23-
private val unit: LengthPercentageType,
23+
public val unit: LengthPercentageType,
2424
) {
2525
public companion object {
2626
@JvmStatic

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewManager.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.facebook.react.module.annotations.ReactModule;
2727
import com.facebook.react.uimanager.BackgroundStyleApplicator;
2828
import com.facebook.react.uimanager.LengthPercentage;
29+
import com.facebook.react.uimanager.LengthPercentageType;
2930
import com.facebook.react.uimanager.PixelUtil;
3031
import com.facebook.react.uimanager.PointerEvents;
3132
import com.facebook.react.uimanager.Spacing;
@@ -156,6 +157,15 @@ public void nextFocusUp(ReactViewGroup view, int viewId) {
156157
})
157158
public void setBorderRadius(ReactViewGroup view, int index, Dynamic rawBorderRadius) {
158159
@Nullable LengthPercentage borderRadius = LengthPercentage.setFromDynamic(rawBorderRadius);
160+
161+
// We do not support percentage border radii on Paper in order to be consistent with iOS (to
162+
// avoid developer surprise if it works on one platform but not another).
163+
if (ViewUtil.getUIManagerType(view) != UIManagerType.FABRIC
164+
&& borderRadius != null
165+
&& borderRadius.getUnit() == LengthPercentageType.PERCENT) {
166+
borderRadius = null;
167+
}
168+
159169
if (ReactNativeFeatureFlags.enableBackgroundStyleApplicator()) {
160170
BackgroundStyleApplicator.setBorderRadius(
161171
view, BorderRadiusProp.values()[index], borderRadius);

0 commit comments

Comments
 (0)