【问题标题】:How to run react-native example on github如何在 github 上运行 react-native 示例
【发布时间】:2016-12-07 09:49:27
【问题描述】:

我是 react-native 的新手。 我已阅读文档:https://facebook.github.io/react-native/docs/button.html#examples

我的问题是:如何在https://github.com/facebook/react-native/blob/master/Examples/UIExplorer/js/ButtonExample.js 中运行文件 ButtonExample.js

我试图在“index.android.js”文件中设置一些东西: ```

import React, {Component} from 'react';
import {
  AppRegistry,
} from 'react-native';
import {examples} from './examples';
AppRegistry.registerComponent('examples', () => examples);

``` 但它没有用。 对不起,我的英语不好。 感谢阅读。

【问题讨论】:

    标签: react-native-android


    【解决方案1】:

    你能发布错误吗?

    您是否满足所需的 react-native 版本? react-native -version
    您是否在工作目录中输入了npm install

    你能定义“运行文件”ButtonExample.js 吗?
    运行 react-native 项目需要移动模拟器或移动设备。

    【讨论】:

    • 我在这个项目中写了一个文件名 ButtonExample.js,在文件 index.android.js 中我用代码导入它: import {ButtonExample} from './ButtonExample';我注册了: AppRegistry.registerComponent('ButtonExample', () => ButtonExample);我的项目名称:ButtonTest
    • 你是如何运行这个项目的?它在哪里不起作用?你能粘贴错误吗?
    猜你喜欢
    • 2015-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-12
    • 1970-01-01
    • 2019-02-28
    • 2016-12-12
    相关资源
    最近更新 更多