React native Image component not working in android -
i'm new react native , i'm having problem working image.
to simplify question, i've created new react native project , added image component in index.android.js below:
/** * sample react native app * https://github.com/facebook/react-native * @flow */ import react, { component } 'react'; import { appregistry, stylesheet, text, view, image, } 'react-native'; class testproject extends component { render() { return ( <view style={styles.container}> <text style={styles.welcome}> welcome react native! </text> <image source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}}/> <text style={styles.instructions}> started, edit index.android.js </text> <text style={styles.instructions}> shake or press menu button dev menu </text> </view> ); } } const styles = stylesheet.create({ container: { flex: 1, justifycontent: 'center', alignitems: 'center', backgroundcolor: '#f5fcff', }, welcome: { fontsize: 20, textalign: 'center', margin: 10, }, instructions: { textalign: 'center', color: '#333333', marginbottom: 5, }, }); appregistry.registercomponent('testproject', () => testproject);
the url inside image component copied react native image documentation. doing wrong? can please me out?
my react native 0.29.0 , , haven't tried in ios yet because right need create android app first.
give height , width of image.
<image source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}} style={{ height: 50, width: 50 }}/>
Comments
Post a Comment