【发布时间】:2021-01-12 03:54:31
【问题描述】:
大家好,Source 和 Style 的类型应该是什么
源将包含图像文件位置。像这样的
source = require('../../../assets/user.png')
样式会有一个样式对象,但不确定我写style: Object是否正确。
export interface AvatarProps {
source?: any; <<<<< Don't want to use any
style?: any; <<<<< Don't want to use any
shape?: string;
ImageComponent?: React.ComponentType;
size?: 'tiny' | 'small' | 'medium' | 'large' | 'giant';
}
export const Avatar: FunctionComponent<AvatarProps> = ({
shape,
style,
size = 'medium',
ImageComponent,
source = require('../../../assets/user.png'),
}) => {
return (
<View>
....
</View>
);
};
【问题讨论】:
标签: javascript reactjs typescript react-native