我今天从React Native开始.我正在学习一个网络教程.

Windows计算机上的所有安装是否正确:

  • Java Jdk
  • Android Studio
  • node /NPM
  • Yarn

然后安装react native

npm install -g react-native-cli

终于有了一个hello world项目

react-native init albums

我没有收到任何错误.我的应用程序在Android手机上运行(基本上可以加载)非常完美.

应用程序.js对平台 Select 有一定的条件:

 /**
 * 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,
  },
});

我只是想知道不生成这些文件是否正常.

The Project structure

推荐答案

这是react native新增的一项功能.新的项目模板现在不包含两个单独的文件.如果你愿意的话,你仍然可以像以前一样创建和使用它,但按原样使用它是正常的.这只是你项目的一个偏好和要求.你可以在here上找到更多关于变化的信息.

From the commit notes

这一变化(最初在

React-native相关问答推荐

Appcenter codepush 返回请求被阻止

使用下拉菜单时react 本机react-native-dropdown-select-list,它会将下面的项目向下移动.如何阻止这种情况发生

将值从一个 js 文件传递​​到 react native 中的另一个 js 文件:react native

导出命名空间应首先由 `@babel/plugin-proposal-export-namespace-from` 转换

React Native TextInput 没有获得焦点

React Native StackNavigator 初始路由名称

withNavigation 只能用于导航器的视图层次 struct

Firebase JavaScript SDK 和 react-native-firebase 有什么区别

submit提交后如何让 React Native TextInput 保持焦点?

如何在 React Native 中按住以 Select 文本

react native如何访问文件系统?

react-native run-android 在设备上构建旧版本的代码

在 react-native-maps 中渲染多个标记

ENOENT: no such file or directory, 打开 'android/app/src/main/assets/index.android.bundle'

我可以使用 react native 开发 pwa

如何从 React-Native 中的另一个类调用函数?

使用 React Native 一次启动多个 Animated.timing

Tools > Android 菜单在 Android Studio 中不存在

开始滚动时使 TouchableOpacity 不突出显示元素

列之间的 React Native FlatList 分隔符