Skip to content

Commit c401334

Browse files
danilobuergerDmitry Rykun
authored and
Dmitry Rykun
committed
Support PlatformColor in borderColor on Android (#33544)
Summary: PlatformColor should work on all *color style attributes on all platform. Partially fixes #32942 ## Changelog [Android] [Fixed] - Support PlatformColor in borderColor Pull Request resolved: #33544 Test Plan: Open rn tester (USE_FABRIC=false) platform color api examples. Without the changes to ViewProps.java, it will error out. Reviewed By: lunaleaps Differential Revision: D39413519 Pulled By: NickGerleman fbshipit-source-id: 58962ba2956aa3df45144108eec194aedf23886b
1 parent f0ffd22 commit c401334

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,14 +278,16 @@ public static boolean isLayoutOnly(ReadableMap map, String prop) {
278278
}
279279
return true;
280280
case BORDER_LEFT_COLOR:
281-
return !map.isNull(BORDER_LEFT_COLOR) && map.getInt(BORDER_LEFT_COLOR) == Color.TRANSPARENT;
281+
return map.getType(BORDER_LEFT_COLOR) == ReadableType.Number
282+
&& map.getInt(BORDER_LEFT_COLOR) == Color.TRANSPARENT;
282283
case BORDER_RIGHT_COLOR:
283-
return !map.isNull(BORDER_RIGHT_COLOR)
284+
return map.getType(BORDER_RIGHT_COLOR) == ReadableType.Number
284285
&& map.getInt(BORDER_RIGHT_COLOR) == Color.TRANSPARENT;
285286
case BORDER_TOP_COLOR:
286-
return !map.isNull(BORDER_TOP_COLOR) && map.getInt(BORDER_TOP_COLOR) == Color.TRANSPARENT;
287+
return map.getType(BORDER_TOP_COLOR) == ReadableType.Number
288+
&& map.getInt(BORDER_TOP_COLOR) == Color.TRANSPARENT;
287289
case BORDER_BOTTOM_COLOR:
288-
return !map.isNull(BORDER_BOTTOM_COLOR)
290+
return map.getType(BORDER_BOTTOM_COLOR) == ReadableType.Number
289291
&& map.getInt(BORDER_BOTTOM_COLOR) == Color.TRANSPARENT;
290292
case BORDER_WIDTH:
291293
return map.isNull(BORDER_WIDTH) || map.getDouble(BORDER_WIDTH) == 0d;

packages/rn-tester/js/examples/PlatformColor/PlatformColorExample.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ function FallbackColorsExample() {
214214
style={{
215215
...styles.colorCell,
216216
backgroundColor: color.color,
217+
borderColor: color.color,
217218
}}
218219
/>
219220
</View>

0 commit comments

Comments
 (0)