Skip to content

Commit

Permalink
Support PlatformColor in borderColor on Android (#33544)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
danilobuerger authored and Dmitry Rykun committed Sep 14, 2022
1 parent f0ffd22 commit c401334
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,14 +278,16 @@ public static boolean isLayoutOnly(ReadableMap map, String prop) {
}
return true;
case BORDER_LEFT_COLOR:
return !map.isNull(BORDER_LEFT_COLOR) && map.getInt(BORDER_LEFT_COLOR) == Color.TRANSPARENT;
return map.getType(BORDER_LEFT_COLOR) == ReadableType.Number
&& map.getInt(BORDER_LEFT_COLOR) == Color.TRANSPARENT;
case BORDER_RIGHT_COLOR:
return !map.isNull(BORDER_RIGHT_COLOR)
return map.getType(BORDER_RIGHT_COLOR) == ReadableType.Number
&& map.getInt(BORDER_RIGHT_COLOR) == Color.TRANSPARENT;
case BORDER_TOP_COLOR:
return !map.isNull(BORDER_TOP_COLOR) && map.getInt(BORDER_TOP_COLOR) == Color.TRANSPARENT;
return map.getType(BORDER_TOP_COLOR) == ReadableType.Number
&& map.getInt(BORDER_TOP_COLOR) == Color.TRANSPARENT;
case BORDER_BOTTOM_COLOR:
return !map.isNull(BORDER_BOTTOM_COLOR)
return map.getType(BORDER_BOTTOM_COLOR) == ReadableType.Number
&& map.getInt(BORDER_BOTTOM_COLOR) == Color.TRANSPARENT;
case BORDER_WIDTH:
return map.isNull(BORDER_WIDTH) || map.getDouble(BORDER_WIDTH) == 0d;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ function FallbackColorsExample() {
style={{
...styles.colorCell,
backgroundColor: color.color,
borderColor: color.color,
}}
/>
</View>
Expand Down

0 comments on commit c401334

Please sign in to comment.