Sunday, May 12, 2024
161
rated 0 times [  163] [ 2]  / answers: 1 / hits: 17626  / 9 Years ago, thu, may 7, 2015, 12:00:00

I'm tinkering with React Native and am trying to simply display an image with the image library from a URL. When I run this, all that is shown is the 'React Native' text, but no image. What am I doing wrong?



'use strict';

var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Image,
Text,
View,
} = React;

var AwesomeProject = React.createClass({
render: function() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
React Native
</Text>
<Image
source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}}
/>
</View>
);
}
});

More From » react-native

 Answers
16

Try giving the image component a height and width value.



<Image style= {{ height:50, width: 50 }} >

[#66705] Tuesday, May 5, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
whitney

Total Points: 642
Total Questions: 110
Total Answers: 98

Location: Solomon Islands
Member since Mon, Jun 20, 2022
2 Years ago
;