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

Is there a way to send local images to a component function?

$
0
0

I would like to send a series of local image files to a component so that they could be rendered.I haven't found any way to do it where images were from local storage. I've only seen it where the images had online links and those links were stored in an object where they were then pulled from.Is there a way I could store multiple locations in an object and then send that to the component?

Product.Component.js

const Product = ({ image }) => {    return (<View style={styles.container}><Text></Text><View><Image                    style={{ width: 225, height: 225 }}                    source={image}                /></View><View style={styles.button}></View></View>    )}

App.js

import Product from './components/Product.Component'import {Image} from 'react-native';export default class App extends React.Component {render() {    return (<Container style={styles.container} ><Product           style={{ width: 225, height: 225 } }<Image source={require('./assets/images/logo/myimage.png')}/>        /></Container >    );}

Viewing all articles
Browse latest Browse all 16552

Trending Articles



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