React Native에 매우 익숙하며 Image 작업에 문제가 있습니다. 이미지 구성 요소 내부네이티브 이미지 구성 요소가 android에서 작동하지 않습니다.
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
} from 'react-native';
class TestProject extends Component {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Image source={{uri: 'http://facebook.github.io/react/img/logo_og.png'}}/>
<Text style={styles.instructions}>
To get started, edit index.android.js
</Text>
<Text style={styles.instructions}>
Shake or press menu button for 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);
URL은 React Native Image documentation에서 복사 :
내 질문을 단순화하기 위해, 나는 새가 아래 index.android.js 네이티브 프로젝트와 방금 추가 한 이미지의 구성 요소를 반응 만들었습니다. 내가 뭘 잘못하고 있니? 누구든지 나를 도울 수 있습니까?내 반응이 네이티브 0.29.0입니다. 아직 안드로이드 앱을 먼저 만들어야하기 때문에 아직 시도하지 않았습니다.
렌더링 할 이미지의 너비와 높이를 지정해야합니다. 스타일 = {{높이 : 30, 너비 : 30}} – Riten
답장을 보내 주셔서 감사합니다. 내가 아직 그걸 시도하지 않았기 때문에 그럴 수도있다. 나는 이미지의 크기를 설정하고 그것이 작동하는지 확인하려고 노력할 것이다. –