-
Notifications
You must be signed in to change notification settings - Fork 739
Fixing phantom label on the wheel picker. #2839
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
Conversation
… white and the background is also white. If you put any darker color you were seeing it
src/components/WheelPicker/index.tsx
Outdated
@@ -222,7 +222,7 @@ const WheelPicker = ({ | |||
const fakeLabelProps = useMemo(() => { | |||
return {...labelMargins, ...labelProps}; | |||
}, [labelMargins, labelProps]); | |||
|
|||
const itemLabelStyle = useMemo(() => ({...labelStyle, opacity: 0}), [labelStyle]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put it in the item
itself.
I'd probably write it as [labelStyle, {opacity}]
but now I've seen this article:
- Best Practices for Styling Performance
...
Flattening Styles: Using arrays for styles can be computationally expensive. Instead, use StyleSheet.flatten to merge style objects.
So maybe more investigation is needed.
I moved the entire opacity add to the fake label in the Item component. I used composed instead of flatten. Because its better if the fakeLabelStyle is not passed and because we don't know if the labelStyle is a stylesheet object. |
Why does it matter? BTW, |
Compose returns an array if both are present and only the object if only one is preset. So if only one given then it never creates an array. I didn't see much difference between them other than that |
See the link in this comment for the reason memoized flatten can be better, and as I stated I am not sure about it and you can search further if this is indeed recommend. |
I don' really find any major difference between them. Its says that flatten uses something with the id in stylesheet but in some places theres mentions that stylesheet doesn't even use those ids anymore. I'll change to flatten any way maybe they'll use it in the future. |
I saw somewhere that the docs are not updated to reflect the changed code. |
Description
There were labels near the values of the wheel picker. Because they were white they could only be seen on darker backgrounds. I added opacity = 0 because removing this label was causing the entire layout to change.
Changelog
WheelPicker - fixed value labels showing near every label.
Additional info
WOAUILIB-3875