Skip to content

WheelPicker (Incubator) - add support for theme #1559

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

Merged
merged 2 commits into from
Sep 19, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 3 additions & 13 deletions generatedTypes/src/incubator/WheelPicker/Item.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { TextStyle } from 'react-native';
import Animated from 'react-native-reanimated';
import { TextProps } from '../../components/text';
export interface ItemProps {
label: string;
Expand All @@ -9,16 +8,7 @@ export interface ItemProps {
fakeLabelProps?: TextProps;
value: string | number;
}
interface InternalProps extends ItemProps {
index: number;
offset: Animated.SharedValue<number>;
itemHeight: number;
activeColor?: string;
inactiveColor?: string;
style?: TextStyle;
onSelect: (index: number) => void;
testID?: string;
centerH?: boolean;
}
declare const _default: React.MemoExoticComponent<({ index, label, fakeLabel, fakeLabelStyle, fakeLabelProps, itemHeight, onSelect, offset, activeColor, inactiveColor, style, testID, centerH }: InternalProps) => JSX.Element>;
declare const _default: React.ComponentClass<ItemProps & {
useCustomTheme?: boolean | undefined;
}, any>;
export default _default;
8 changes: 5 additions & 3 deletions generatedTypes/src/incubator/WheelPicker/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/// <reference types="react" />
import React from 'react';
import { TextStyle, ViewStyle } from 'react-native';
import { ItemProps } from './Item';
import { TextProps } from '../../components/text';
Expand Down Expand Up @@ -72,8 +72,10 @@ export interface WheelPickerProps {
align?: WheelPickerAlign;
testID?: string;
}
declare const WheelPicker: {
declare const _default: React.ComponentClass<WheelPickerProps & {
useCustomTheme?: boolean | undefined;
}, any> & {
({ items: propItems, itemHeight, numberOfVisibleRows, activeTextColor, inactiveTextColor, textStyle, label, labelStyle, labelProps, onChange, align, style, children, initialValue, selectedValue, testID }: WheelPickerProps): JSX.Element;
alignments: typeof WheelPickerAlign;
};
export default WheelPicker;
export default _default;
6 changes: 5 additions & 1 deletion src/incubator/WheelPicker/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Animated, {interpolateColor, useAnimatedStyle} from 'react-native-reanima
import Text, {TextProps} from '../../components/text';
import TouchableOpacity from '../../components/touchableOpacity';
import {Colors, Spacings} from '../../../src/style';
import {asBaseComponent} from '../../commons/new';

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

export default memo(({
const WheelPickerItem = memo(({
index,
label,
fakeLabel,
Expand Down Expand Up @@ -86,6 +87,9 @@ export default memo(({
);
});

WheelPickerItem.displayName = 'Incubator.WheelPickerItem';
export default asBaseComponent<ItemProps>(WheelPickerItem);

const styles = StyleSheet.create({
container: {
minWidth: Spacings.s10
Expand Down
4 changes: 3 additions & 1 deletion src/incubator/WheelPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {Constants} from 'helpers';
import Item, {ItemProps} from './Item';
import usePresenter from './usePresenter';
import Text, {TextProps} from '../../components/text';
import {asBaseComponent} from '../../commons/new';

const AnimatedFlatList = Animated.createAnimatedComponent(FlatList);

Expand Down Expand Up @@ -294,7 +295,8 @@ const WheelPicker = ({
};

WheelPicker.alignments = WheelPickerAlign;
export default WheelPicker;
WheelPicker.displayName = 'Incubator.WheelPicker';
export default asBaseComponent<WheelPickerProps, typeof WheelPicker>(WheelPicker);

const styles = StyleSheet.create({
separators: {
Expand Down