@uiw/react-native
Version:
UIW for React Native
39 lines (38 loc) • 1.22 kB
TypeScript
import React, { Component } from 'react';
import { ViewProps, ViewStyle, TextStyle, StyleProp, ImageStyle, GestureResponderEvent } from 'react-native';
interface ItemData {
icon?: React.ReactNode;
text?: React.ReactNode;
}
export interface GridProps extends ViewProps {
/**
* 传入的菜单数据,`icon` 可以是 `ReactNode` 或者 `uri`
* @default []
*/
data?: ItemData[];
/**
* 列数
* @default 4
*/
columns?: number;
/**
* 是否有间隔线
* @default true
*/
hasLine?: boolean;
/** 单元格样式 */
itemStyle?: StyleProp<ViewStyle>;
/** 单元格文本样式 */
textStyle?: StyleProp<TextStyle & ViewStyle>;
/** 图片样式,可设置图片/图标尺寸 */
iconStyle?: StyleProp<ImageStyle & TextStyle & ViewStyle>;
/** 自定义单元格 */
renderItem?: (data: ItemData, index: number, row: number) => React.ReactNode;
/** 点击宫格回调函数 */
onPress?: (data: ItemData, index: number, row: number, event: GestureResponderEvent) => void;
}
export default class Grid extends Component<GridProps> {
static defaultProps: GridProps;
render(): JSX.Element | null;
}
export {};