mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
b67dc01d1d
commit
42b6e6682c
@@ -258,7 +258,9 @@ public class ViewProps {
|
||||
// Ignore if explicitly set to default opacity.
|
||||
return map.isNull(OPACITY) || map.getDouble(OPACITY) == 1d;
|
||||
case BORDER_RADIUS: // Without a background color or border width set, a border won't show.
|
||||
if (map.hasKey(BACKGROUND_COLOR) && map.getInt(BACKGROUND_COLOR) != Color.TRANSPARENT) {
|
||||
if (map.hasKey(BACKGROUND_COLOR)
|
||||
&& !map.isNull(BACKGROUND_COLOR)
|
||||
&& map.getInt(BACKGROUND_COLOR) != Color.TRANSPARENT) {
|
||||
return false;
|
||||
}
|
||||
if (map.hasKey(BORDER_WIDTH)
|
||||
|
||||
Reference in New Issue
Block a user