Skip to content

Commit 61273bf

Browse files
committed
Separate to two examples: months and years
1 parent 6f93363 commit 61273bf

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

demo/src/screens/incubatorScreens/WheelPickerScreen.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {View, Text, Incubator} from 'react-native-ui-lib';
33
import _ from 'lodash';
44

55
// Months
6-
const items = [
6+
const months = [
77
'January',
88
'February',
99
'March',
@@ -19,16 +19,17 @@ const items = [
1919
];
2020

2121
// Years
22-
// const items = _.times(2000, i => i);
22+
const years = _.times(2020, i => i);
2323

2424
export default () => {
2525
return (
2626
<View flex padding-page>
2727
<Text h1>Wheel Picker</Text>
2828
<View flex centerH paddingT-page>
29-
<Incubator.WheelPicker
30-
items={_.map(items, (i) => ({text: i, value: i}))}
31-
/>
29+
<Text h3>Months</Text>
30+
<Incubator.WheelPicker items={_.map(months, i => ({text: i, value: i}))} />
31+
<Text h3 marginT-s5>Years</Text>
32+
<Incubator.WheelPicker items={_.map(years, i => ({text: i, value: i}))} />
3233
</View>
3334
</View>
3435
);

src/incubator/WheelPicker/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// TODO: Support control of visible items
44
import _ from 'lodash';
55
import React, {useCallback, useRef} from 'react';
6-
import {TextStyle, FlatList} from 'react-native';
6+
import {TextStyle, FlatList, StyleProp} from 'react-native';
77
import Animated from 'react-native-reanimated';
88
import {onScrollEvent, useValues} from 'react-native-redash';
99

@@ -17,7 +17,7 @@ const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
1717
export interface WheelPickerProps {
1818
items?: ItemProps[];
1919
itemHeight?: number;
20-
itemTextStyle?: TextStyle;
20+
itemTextStyle?: StyleProp<TextStyle>;
2121
onChange: (item: ItemProps, index: number) => void;
2222
}
2323

0 commit comments

Comments
 (0)