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

Conversation

freeboub
Copy link

Description

Fix rippleColor declaration on pressable
fix: #3246
I think colorValue can be used without processColor but here an Int32 is needed

Test plan

I tested with the sample included in the package.
I didn't retest with old architecture but no impact expected, And I already tested it sucessfully

Copy link
Contributor

@latekvo latekvo left a comment

Choose a reason for hiding this comment

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

Hi, the overall premise of this PR is great, it removes the necessity to use processColor on paper when using hexadecimal colors.
Unfortunately these changes cause a crash when you try setting ripple_color by the color's name (red). I'm currently looking into why fabric works, while paper doesn't, and if the two architectures simply have varying workflows, or some other issues.

@@ -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.

@@ -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.

@freeboub
Copy link
Author

freeboub commented Dec 8, 2024

@latekvo Sorry for the delayed answer, but I am a bit lost to find the best fix...
I agree keeping ColorValue in the spec file would be better

  • If I just remove processColor from the JS, It works as is with new arch (Then can keep the ColorValue)
  • but it fails with paper in ColorPropConverter.getColor because the input is a string, not an integer...

Do you think it is a good idea to remove the processColor in JS ? if yes, do you know which call should be done on paper version to transform the string color to integer color on native side ?

Notice that processColor return a ProcessedColorValue, not a ColorValue, I also tried to replace the type to ProcessedColorValue, not better with fabric ...

@freeboub freeboub marked this pull request as draft December 20, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Pressable] android_ripple / color doesn't work correctly
2 participants