導(dǎo)入react-native運(yùn)行就報(bào)錯(cuò),急求老師指點(diǎn),謝謝!
[error][tid:com.facebook.react.JavaScript] Seems you're trying to access 'ReactNative.createClass' from the 'react-native' package. Perhaps you meant to access 'React.createClass' from the 'react' package instead?
For example, instead of:
? import React, { Component, View } from 'react-native';
You should now do:
? import React, { Component } from 'react';
? import { View } from 'react-native';
Check the release notes on how to upgrade your code - https://github.com/facebook/react-native/releases/tag/v0.25.1
請(qǐng)問(wèn)老師:我通過(guò)require導(dǎo)入react-native的時(shí)候報(bào)錯(cuò),使用以下方式的時(shí)候正常:
import React, { Component } from 'react';
import {
? AppRegistry,
? StyleSheet,
? View,
? PixelRatio,
? Text,
} from 'react-native';
2016-12-17
這個(gè)是版本的問(wèn)題,我在ES5寫(xiě)的項(xiàng)目中使用ES6寫(xiě)法導(dǎo)致的。
2016-11-04
React Native的代碼不能直接粘貼過(guò)來(lái),ReactJS用的是HTML標(biāo)簽,React Native用的是XML標(biāo)簽,并且ReactJS not ? AppRegistry,StyleSheet,Text,View,TouchableHighlight,ToastAndroid....................
2016-10-21
HI, 我也遇到相同的問(wèn)題
代碼如下:
import React, {Component,PropTypes} from 'react';
import {
?AppRegistry,
?StyleSheet,
?Text,
?View,
?TouchableHighlight,
?ToastAndroid,
} from 'react-native';
var {NativeModules} = require('react-native');
2016-09-25
我也遇到這個(gè)問(wèn)題了,怎么解決啊
2016-08-19
沒(méi)明白你的具體問(wèn)題,像下面這種寫(xiě)法是ES6的,現(xiàn)在react-native用的都是ES6的寫(xiě)法。具體相關(guān)寫(xiě)法你應(yīng)該查查ES6