我最近开始使用react-native.我使用Facebook网站上的教程安装它,一切都运行良好一两天,直到出现此消息:
'react-native' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
除了卸载所有内容并重新开始之外,没有任何作用.环境还可以工作(npm,choco等).我还尝试删除并添加react-native到环境变量,重新启动,在管理员模式下运行cmd,但到目前为止还没有.我应该补充一点,我使用Windows 10 64位.
我最近考虑过从Eclipse迁移到Android Studio,当然我遇到了困难.我设法超越了他们中的大多数但只有一个......
在eclipse中,我会使用一个库项目,然后我会添加到我想要使用它的每个Eclipse项目中.当我更新库时,效果立即在其他项目中可见.
在android studio中,故事有所不同.我设法生成.aar文件并将其导入我的项目中.麻烦的是,有什么办法可以让所有这些项目都更新.aar,而不必为每个项目再次复制文件(显然很乏味).如果没有,有没有办法像我在eclipse中使用它们那样使用库项目?我基本上想要的是一种在使用它的所有项目中自动更新库更改的方法.
我有这段反应原生代码:
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
ToolbarAndroid,
ListView,
Text,
View
} from 'react-native';
let styles = require('./styles/styles');
class Sunshine extends Component {
constructor(props) {
super(props);
this.state = {isLoading: true, jsonData: ''}
}
componentDidMount() {
this.setState({jsonData: this.getMoviesFromApiAsync()})
}
render() {
if(this.state.isLoading != true) {
return (
<View style={styles.container}>
<ToolbarAndroid
style={styles.baseToolbar}
logo={require('./ic_launcher.png')}
title="Sunshine"
titleTextColor="red"/>
<View style={styles.viewcontainer}>
<Text>{this.state.jsonData.city.id}</Text>
<ListView
dataSource={this.state.jsonData.list}
renderRow={(rowData) => <Text>{rowData.dt}</Text>}
/>
</View>
</View>
);
} else {
return (
<View style={styles.container}>
<ToolbarAndroid
style={styles.baseToolbar}
logo={require('./ic_launcher.png')} …Run Code Online (Sandbox Code Playgroud)