0
爲什麼我的移動設備上運行應用程序時不顯示圖像?我只是按照這個教程,並添加了幾行代碼:https://facebook.github.io/react-native/docs/getting-started.html。來自URL中的圖像不會在Android中顯示原始應用程序
import React, {
Component
} from 'react';
import {
AppRegistry,
Image,
StyleSheet,
Text,
View
} from 'react-native';
var MOCKED_MOVIES_DATA = [
{title: 'Title', year: '2015', posters: {thumbnail: 'http://i.imgur.com/UePbdph.jpg'}},
];
export default class AwesomeProject extends Component {
render() {
var movie = MOCKED_MOVIES_DATA[0];
return (
<View style={styles.container}>
<Text>{movie.title}</Text>
<Text>{movie.year}</Text>
<Image source={{uri: movie.posters.thumbnail}} />
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
});
AppRegistry.registerComponent('AwesomeProject',() => AwesomeProject);
寬度高度屬性添加到圖像 –
這一工作的風格''<圖像樣式= {{寬度:60,高度:60}}源= {{URI:movie.posters.thumbnail}} /> ''! – santafebound