Android undefined不是用于创建类的函数
我已经开始学习react native,当我在网上学习不同的教程时,有些使用Ecma6,有些则没有。在我读到的大多数地方,我们可以选择使用这两种语法中的任何一种。但当我尝试创建没有ECMA6的应用程序时,它总是给我这个错误Android undefined不是用于创建类的函数,android,react-native,Android,React Native,我已经开始学习react native,当我在网上学习不同的教程时,有些使用Ecma6,有些则没有。在我读到的大多数地方,我们可以选择使用这两种语法中的任何一种。但当我尝试创建没有ECMA6的应用程序时,它总是给我这个错误 undefined is not a function evaluating react create class 这是我的代码: 'use strict'; var React = require('react-native'); var { AppRegistr
undefined is not a function evaluating react create class
这是我的代码:
'use strict';
var React = require('react-native');
var {
AppRegistry,
StyleSheet,
Text,
TextInput,
View,
Image,
ListView
} = React;
var MyApp = React.createClass({
......
});
AppRegistry.registerComponent('MyApp', () => MyApp);
在新版本的react-native中,我是否遗漏了一些内容,或者在没有ECMA6的情况下无法使用代码我正在使用版本0.27,从react导入react和react-native的其他组件修复了该问题
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
TextInput,
View,
Image,
ListView
} from 'react-native';
从React和React native导入React和其他组件解决了此问题
import React from 'react';
import {
AppRegistry,
StyleSheet,
Text,
TextInput,
View,
Image,
ListView
} from 'react-native';
相关的谢谢@Chernivrelevant?:谢谢你@Cherniv