2016-12-07 36 views
0

我是react-native的新手。 我在读文件:https://facebook.github.io/react-native/docs/button.html#examples如何在github上运行react-native示例

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

我试图建立东西“index.android.js”文件运行文件ButtonExample.js

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

``` 但它没有奏效。 对不起,我的英文不好。 感谢您的阅读。

回答

0

你可以发布错误吗?

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

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

+0

我在此项目中编写了文件名ButtonExample.js,并在文件index.android.js中导入了代码: 从'./ButtonExample'导入{ButtonExample}; 我注册了: AppRegistry.registerComponent('ButtonExample',()=> ButtonExample); 我的项目名称:ButtonTest – XuHo

+0

您是如何运行项目的?它不工作在哪里?你能粘贴错误吗? – Ethan