@uiw/react-native
Version:
UIW for React Native
39 lines (38 loc) • 1.22 kB
TypeScript
import React from 'react';
import { StyleProp, TextStyle, ViewStyle } from 'react-native';
export interface PickerData {
label?: string;
render?: (key: string, record: PickerData, index: number) => React.ReactNode;
[key: string]: any;
}
export interface PickerProps {
/** 显示几行, 默认 3 */
lines?: number;
/** 指定需要显示的 key, 默认使用 data 的 label 属性 */
rowKey?: string;
/** 需要渲染的数据 */
data?: Array<PickerData>;
/** item 容器样式 */
containerStyle?: {
/** 激活的容器样式 */
actived?: StyleProp<ViewStyle>;
/** 未激活的容器样式 */
unactived?: StyleProp<ViewStyle>;
};
/** 容器的文本样式 */
textStyle?: {
/** 激活的文本样式 */
actived?: StyleProp<TextStyle>;
/** 未激活的文本样式 */
unactived?: StyleProp<TextStyle>;
};
/** 选中当前项的下标 */
value?: number;
/** 是否只读 */
readonly?: boolean;
/** value 改变时触发 */
onChange?: (value: number) => unknown;
onScrollEnd?: () => void;
}
declare const Picker: (props: PickerProps) => JSX.Element;
export default Picker;