Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rippleColor shall be declared as integer #3250

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void setProperty(T view, String propName, @Nullable Object value) {
mViewManager.setEnabled(view, value == null ? true : (boolean) value);
break;
case "rippleColor":
mViewManager.setRippleColor(view, ColorPropConverter.getColor(value, view.getContext()));
Copy link
Contributor

@latekvo latekvo Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing ColorPropConverter.getColor(value, view.getContext() breaks paper builds when trying to set the color by it's name (green or red).
This issue only affects paper.

mViewManager.setRippleColor(view, value == null ? 0 : ((Double) value).intValue());
break;
case "rippleRadius":
mViewManager.setRippleRadius(view, value == null ? 0 : ((Double) value).intValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface RNGestureHandlerButtonManagerInterface<T extends View> {
void setForeground(T view, boolean value);
void setBorderless(T view, boolean value);
void setEnabled(T view, boolean value);
void setRippleColor(T view, @Nullable Integer value);
void setRippleColor(T view, int value);
void setRippleRadius(T view, int value);
void setTouchSoundDisabled(T view, boolean value);
void setBorderWidth(T view, float value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class RNGestureHandlerButtonViewManager : ViewGroupManager<ButtonViewGroup>(), R
}

@ReactProp(name = "rippleColor")
override fun setRippleColor(view: ButtonViewGroup, rippleColor: Int?) {
override fun setRippleColor(view: ButtonViewGroup, rippleColor: Int) {
view.rippleColor = rippleColor
}

Expand Down
2 changes: 1 addition & 1 deletion src/specs/RNGestureHandlerButtonNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface NativeProps extends ViewProps {
foreground?: boolean;
borderless?: boolean;
enabled?: WithDefault<boolean, true>;
rippleColor?: ColorValue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to avoid overwriting this type?
Color may also be described as a string (red or green), replacing this type with Int32 removes that possibility.

rippleColor?: Int32;
rippleRadius?: Int32;
touchSoundDisabled?: WithDefault<boolean, false>;
borderWidth?: Float;
Expand Down