fix undefined colors on litho components
Summary: When a color was changed on a litho component, the changes were made, but the display in Flipper's layout sidebar always showed `rgba(0,0,0,0)` as a color. This was because reading the color failed for `ComparableColorDrawable` and it sent `0` as fallback value. This diff adds an additional check if the value is an instance of `ComparableColorDrawable` and reads the color from it. Reviewed By: passy Differential Revision: D15469093 fbshipit-source-id: 7f1aaf1c4981815605aca5ba735fa09e80deaa42
This commit is contained in:
committed by
Facebook Github Bot
parent
b78fb88dd7
commit
53b852dbe6
@@ -447,7 +447,9 @@ class DataDescriptionContainer extends Component<{
|
||||
|
||||
case 'color': {
|
||||
const colorInfo = parseColor(val);
|
||||
if (colorInfo) {
|
||||
if (typeof val === 'number' && val === 0) {
|
||||
return <UndefinedValue>(not set)</UndefinedValue>;
|
||||
} else if (colorInfo) {
|
||||
const {a, b, g, r} = colorInfo;
|
||||
return [
|
||||
<ColorBox key="color-box" color={`rgba(${r}, ${g}, ${b}, ${a})`} />,
|
||||
|
||||
Reference in New Issue
Block a user