Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
yskoht authored and set0gut1 committed Dec 11, 2020
1 parent 2765172 commit c1dd198
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,21 @@ public BoxedIntPropSetter(ReactPropGroup prop, Method setter, int index) {
}
}

private static class BoxedColorPropSetter extends PropSetter {

public BoxedColorPropSetter(ReactProp prop, Method setter) {
super(prop, "mixed", setter);
}

@Override
protected @Nullable Object getValueOrDefault(Object value, Context context) {
if (value != null) {
return ColorPropConverter.getColor(value, context);
}
return null;
}
}

/*package*/ static Map<String, String> getNativePropsForView(
Class<? extends ViewManager> viewManagerTopClass,
Class<? extends ReactShadowNode> shadowNodeTopClass) {
Expand Down Expand Up @@ -418,7 +433,7 @@ private static PropSetter createPropSetter(
return new BoxedBooleanPropSetter(annotation, method);
} else if (propTypeClass == Integer.class) {
if ("Color".equals(annotation.customType())) {
return new ColorPropSetter(annotation, method);
return new BoxedColorPropSetter(annotation, method);
}
return new BoxedIntPropSetter(annotation, method);
} else if (propTypeClass == ReadableArray.class) {
Expand Down

0 comments on commit c1dd198

Please sign in to comment.