Skip to content

Commit b785591

Browse files
committed
fix: allow wheelpicker to change tint for fader
1 parent fe20914 commit b785591

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/components/sectionsWheelPicker/sectionsWheelPicker.api.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@
2424
{"name": "inactiveTextColor", "type": "string", "description": "Text color for other, non-focused rows"},
2525
{"name": "textStyle", "type": "TextStyle", "description": "Row text style"},
2626
{"name": "xxx", "type": "xxxx", "description": "xxxxx"},
27-
{"name": "testID", "type": "string", "description": "The component test id"}
27+
{"name": "testID", "type": "string", "description": "The component test id"},
28+
{"name": "faderProps", "type": "FaderProps", "description": "Custom props for fader."}
2829
],
29-
"snippet": [
30-
"<SectionsWheelPicker sections={$1}/>"
31-
]
30+
"snippet": ["<SectionsWheelPicker sections={$1}/>"]
3231
}

src/incubator/WheelPicker/index.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Animated, {useSharedValue, useAnimatedScrollHandler} from 'react-native-r
66
import {Colors, Spacings} from 'style';
77
import {Constants, asBaseComponent} from '../../commons/new';
88
import View from '../../components/view';
9-
import Fader, {FaderPosition} from '../../components/fader';
9+
import Fader, {FaderPosition, FaderProps} from '../../components/fader';
1010
import Item, {ItemProps} from './Item';
1111
import Text, {TextProps} from '../../components/text';
1212
import usePresenter from './usePresenter';
@@ -78,6 +78,10 @@ export interface WheelPickerProps {
7878
*/
7979
separatorsStyle?: ViewStyle;
8080
testID?: string;
81+
/**
82+
* Change the default (white) tint color of the fade view.
83+
*/
84+
faderProps?: Omit<FaderProps, 'visible' | 'position'>;
8185
}
8286

8387
const WheelPicker = ({
@@ -96,7 +100,8 @@ const WheelPicker = ({
96100
children,
97101
initialValue = 0,
98102
separatorsStyle,
99-
testID
103+
testID,
104+
faderProps
100105
}: WheelPickerProps) => {
101106
const scrollView = useRef<Animated.ScrollView>();
102107
const offset = useSharedValue(0);
@@ -242,7 +247,7 @@ const WheelPicker = ({
242247
}, [flatListWidth, labelContainerStyle, label, labelProps, activeTextColor, labelStyle]);
243248

244249
const fader = useMemo(() => (position: FaderPosition) => {
245-
return <Fader visible position={position} size={60}/>;
250+
return <Fader visible position={position} size={60} {...faderProps} />;
246251
},
247252
[]);
248253

0 commit comments

Comments
 (0)