Skip to content

Commit 42b6e66

Browse files
Peter Laraiafacebook-github-bot
Peter Laraia
authored andcommitted
Fix crash - check if backgroundColor is null before trying to fetch it in ViewProps isLayoutOnly
Summary: Noticed while working in MobileHome with android device, when interacting with the Tasks change progress/priority components (MobileHomeTasksDetailsSelectorToken), which provides `borderRadius` style and `backgroundColor: ifSelected ? value : null`, and when `backgroundColor` is `null`, the line changed in this diff crashes (throwing the `NoSuchKeyException` at `ReadableNativeMap:110` [because of isNull check on `ReadableNativeMap:107`]) Changelog: [Android][Fixed] - Fixed crash when using style borderRadius: any with backgroundColor: null Reviewed By: JoshuaGross Differential Revision: D27932828 fbshipit-source-id: 801b04c856ee9dc5a36bbf3e6e3d81de9b1e81a1
1 parent b67dc01 commit 42b6e66

File tree

1 file changed

+3
-1
lines changed
  • ReactAndroid/src/main/java/com/facebook/react/uimanager/interfaces

1 file changed

+3
-1
lines changed

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ public static boolean isLayoutOnly(ReadableMap map, String prop) {
258258
// Ignore if explicitly set to default opacity.
259259
return map.isNull(OPACITY) || map.getDouble(OPACITY) == 1d;
260260
case BORDER_RADIUS: // Without a background color or border width set, a border won't show.
261-
if (map.hasKey(BACKGROUND_COLOR) && map.getInt(BACKGROUND_COLOR) != Color.TRANSPARENT) {
261+
if (map.hasKey(BACKGROUND_COLOR)
262+
&& !map.isNull(BACKGROUND_COLOR)
263+
&& map.getInt(BACKGROUND_COLOR) != Color.TRANSPARENT) {
262264
return false;
263265
}
264266
if (map.hasKey(BORDER_WIDTH)

0 commit comments

Comments
 (0)