Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Image type in typescript

$
0
0

Hello guys what should be the type of Source and Style

The source is going to contain the image file location. Something like this

source = require('../../../assets/user.png')

and style is going to have an Object of styles but not sure if I write style: Object will be right.

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>    );};

Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>