我正在研究一个示例反应原生项目.几乎所有的功能除了<Image source=''/> 与它一起工作.该图像显示在android studio和genymotion提供的android模拟器中,但不适用于任何真实设备(moto G3 turbo,nexus 5,galaxy s4等...).我不知道我的代码出了什么问题.这是我的代码
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image
} from 'react-native';
class ImageTester extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Double tap R on your keyboard to reload,{'\n'}
Shake or press menu button for dev menu
</Text>
<Image source={require('./img/first_image.png')}></Image>
</View>
);
}
}
const styles = …Run Code Online (Sandbox Code Playgroud)