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

React Native Image source prop type?

$
0
0

I have a BackgroundImage component that receives a prop from its parent component:

<BackgroundImage        backgroundImage={require("../../assets/png/backgroundImage1.png")}>

And the BackgroundImage component has backgroundImage as a prop. I need to specify an interface for the props:

const BackgroundImage: FunctionComponent<BackgroundProps> = ({  children,  backgroundImage,}) => (<ImageBackground source={backgroundImage} style={styles.gradient}>    {children}</ImageBackground>);

I am having troubles with specifying which type of prop is backgroundImage in the component interface. I don't want to use "any", like I am doing here:

interface BackgroundProps {  backgroundImage: any;}

Which prop should I use instead of "any"? I am running out of options.


Viewing all articles
Browse latest Browse all 6288

Trending Articles



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