I wanted to add a full-screen image to the View so I write this code
return (
<View style={styles.container}>
<Image source={require('image!egg')} style={styles.backgroundImage}/>
</View>
)
and defined the style as
var styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
flexDirection: 'column',
},
backgroundImage:{
width:320,
height:480,
}
...
but in this way how am I supposed to find the actual iPhone screen size?
I've seen an API to access the Pixel Density but nothing about the screen size...
Any idea?
(This has been deprecated now you can use ImageBackground)
This is how I've done it. The main deal was getting rid of the static fixed sizes.
class ReactStrap extends React.Component {
render() {
return (
<Image source={require('image!background')} style={styles.container}>
... Your Content ...
</Image>
);
}
}
var styles = StyleSheet.create({
container: {
flex: 1,
// remove width and height to override fixed static size
width: null,
height: null,
}
};