I am new to responding to my native language and want to create a small test application in Android and iOS.
I created an image directory next to my index.ios.js and index.android.js files.
In my code below, a red screen error appears that says: "The module could not be resolved. /Images/tree.png ... Invalid directory ...":
'use strict'; var React = require('react-native'); var { AppRegistry, StyleSheet, Text, View, Image, } = React; var TestApp = React.createClass({ render: function() { return ( <View> <Text>test app</Text> <Image style={styles.thumbnail} source={require('./images/tree.png')} /> /> </View> ); }, }); var styles = StyleSheet.create({ thumbnail: { width: 100, height: 100, }, }); AppRegistry.registerComponent('TestApp', () => TestApp);
Where should I post my images and how do I link them?
source share