Skip to content

Commit bb7483c

Browse files
authored
Fixing phantom label on the wheel picker. (#2839)
* Every item label was rendering. We didn't see it because the color is white and the background is also white. If you put any darker color you were seeing it * Fixed callback dependecies * reverting changes to wheelpicker * Formattings * Added 0 opacity to the fake label * Changed flatten to compose. Its better when the labelStyle is not given * Changed composed to flatten
1 parent 74be3c1 commit bb7483c

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/components/WheelPicker/Item.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ const WheelPickerItem = memo(({
7373
return [animatedColorStyle, style, fakeLabel ? textWithLabelPaddingStyle : styles.textPadding];
7474
}, [style, fakeLabel, animatedColorStyle, textWithLabelPaddingStyle]);
7575

76+
const _fakeLabelStyle = useMemo(() => StyleSheet.flatten([fakeLabelStyle, styles.hidden]), [fakeLabelStyle]);
7677
return (
7778
<AnimatedTouchableOpacity
7879
activeOpacity={1}
@@ -88,22 +89,11 @@ const WheelPickerItem = memo(({
8889
testID={testID}
8990
row
9091
>
91-
<AnimatedText
92-
text60R
93-
testID={`${testID}.text`}
94-
numberOfLines={1}
95-
style={textStyle}
96-
recorderTag={'unmask'}
97-
>
92+
<AnimatedText text60R testID={`${testID}.text`} numberOfLines={1} style={textStyle} recorderTag={'unmask'}>
9893
{label}
9994
</AnimatedText>
10095
{fakeLabel && (
101-
<Text
102-
text80M
103-
$textDefaultLight
104-
{...fakeLabelProps}
105-
style={fakeLabelStyle}
106-
>
96+
<Text text80M $textDefaultLight {...fakeLabelProps} style={_fakeLabelStyle}>
10797
{fakeLabel}
10898
</Text>
10999
)}
@@ -122,5 +112,8 @@ const styles = StyleSheet.create({
122112
},
123113
disableRTL: {
124114
flexDirection: 'row-reverse'
115+
},
116+
hidden: {
117+
opacity: 0
125118
}
126119
});

0 commit comments

Comments
 (0)