Tôi bắt đầu với React-Native ngay hôm nay. Và tôi đang theo một hướng dẫn trên web.React Native project, index.ios.js hoặc index.android.js không được tạo
Did tất cả các cài đặt chính xác trên máy tính Windows của tôi:
- Java JDK
- Android Studio
- Node/NPM
- Sợi
sau đó cài đặt phản ứng bản địa
npm install -g react-native-cli
dự án
react-native init albums
tôi không nhận được bất kỳ lỗi cuối cùng là một thế giới hello. Ứng dụng của tôi chạy (về cơ bản tải lên) trên điện thoại Android của tôi một cách hoàn hảo.
Các app.js là chút có điều kiện trên nền tảng sự lựa chọn:
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
Platform,
StyleSheet,
Text,
View
} from 'react-native';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' +
'Cmd+D or shake for dev menu',
android: 'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
export default class App 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 App.js
</Text>
<Text style={styles.instructions}>
{instructions}
</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,
},
});
Tôi chỉ muốn biết nếu điều này là bình thường không có được những tập tin được tạo. Tôi có nên tạo 2 tệp chỉ mục này không? Hoặc phản ứng bản địa mới nhất không cần 2 tệp riêng biệt? (Các hướng dẫn tôi sau đây là của Jan 2017)
Đối với bất kỳ ai khác làm udemy phản ứng khóa học tự nhiên, điều này được mong đợi: https://www.udemy.com/the-complete-react-native-and-redux-course/learn/v4/questions/2954846 – RyPope