Skip to content

Commit abf756f

Browse files
authored
WheelPicker (Incubator) - add support for theme (#1559)
* WheelPicker (Incubator) - add support for theme * Add displayName
1 parent c45825a commit abf756f

File tree

4 files changed

+17
-18
lines changed

4 files changed

+17
-18
lines changed
Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import React from 'react';
22
import { TextStyle } from 'react-native';
3-
import Animated from 'react-native-reanimated';
43
import { TextProps } from '../../components/text';
54
export interface ItemProps {
65
label: string;
@@ -9,16 +8,7 @@ export interface ItemProps {
98
fakeLabelProps?: TextProps;
109
value: string | number;
1110
}
12-
interface InternalProps extends ItemProps {
13-
index: number;
14-
offset: Animated.SharedValue<number>;
15-
itemHeight: number;
16-
activeColor?: string;
17-
inactiveColor?: string;
18-
style?: TextStyle;
19-
onSelect: (index: number) => void;
20-
testID?: string;
21-
centerH?: boolean;
22-
}
23-
declare const _default: React.MemoExoticComponent<({ index, label, fakeLabel, fakeLabelStyle, fakeLabelProps, itemHeight, onSelect, offset, activeColor, inactiveColor, style, testID, centerH }: InternalProps) => JSX.Element>;
11+
declare const _default: React.ComponentClass<ItemProps & {
12+
useCustomTheme?: boolean | undefined;
13+
}, any>;
2414
export default _default;

generatedTypes/src/incubator/WheelPicker/index.d.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/// <reference types="react" />
1+
import React from 'react';
22
import { TextStyle, ViewStyle } from 'react-native';
33
import { ItemProps } from './Item';
44
import { TextProps } from '../../components/text';
@@ -72,8 +72,11 @@ export interface WheelPickerProps {
7272
align?: WheelPickerAlign;
7373
testID?: string;
7474
}
75-
declare const WheelPicker: {
75+
declare const _default: React.ComponentClass<WheelPickerProps & {
76+
useCustomTheme?: boolean | undefined;
77+
}, any> & {
7678
({ items: propItems, itemHeight, numberOfVisibleRows, activeTextColor, inactiveTextColor, textStyle, label, labelStyle, labelProps, onChange, align, style, children, initialValue, selectedValue, testID }: WheelPickerProps): JSX.Element;
7779
alignments: typeof WheelPickerAlign;
80+
displayName: string;
7881
};
79-
export default WheelPicker;
82+
export default _default;

src/incubator/WheelPicker/Item.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import Animated, {interpolateColor, useAnimatedStyle} from 'react-native-reanima
44
import Text, {TextProps} from '../../components/text';
55
import TouchableOpacity from '../../components/touchableOpacity';
66
import {Colors, Spacings} from '../../../src/style';
7+
import {asBaseComponent} from '../../commons/new';
78

89
const AnimatedTouchableOpacity = Animated.createAnimatedComponent(TouchableOpacity);
910
const AnimatedText = Animated.createAnimatedComponent(Text);
@@ -28,7 +29,7 @@ interface InternalProps extends ItemProps {
2829
centerH?: boolean;
2930
}
3031

31-
export default memo(({
32+
const WheelPickerItem = memo(({
3233
index,
3334
label,
3435
fakeLabel,
@@ -86,6 +87,9 @@ export default memo(({
8687
);
8788
});
8889

90+
WheelPickerItem.displayName = 'Incubator.WheelPickerItem';
91+
export default asBaseComponent<ItemProps>(WheelPickerItem);
92+
8993
const styles = StyleSheet.create({
9094
container: {
9195
minWidth: Spacings.s10

src/incubator/WheelPicker/index.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {Constants} from 'helpers';
1010
import Item, {ItemProps} from './Item';
1111
import usePresenter from './usePresenter';
1212
import Text, {TextProps} from '../../components/text';
13+
import {asBaseComponent} from '../../commons/new';
1314

1415
const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);
1516

@@ -294,7 +295,8 @@ const WheelPicker = ({
294295
};
295296

296297
WheelPicker.alignments = WheelPickerAlign;
297-
export default WheelPicker;
298+
WheelPicker.displayName = 'Incubator.WheelPicker';
299+
export default asBaseComponent<WheelPickerProps, typeof WheelPicker>(WheelPicker);
298300

299301
const styles = StyleSheet.create({
300302
separators: {

0 commit comments

Comments
 (0)