react-native-baidumap icon indicating copy to clipboard operation
react-native-baidumap copied to clipboard

Error: import React from 'react-native';

Open wind13 opened this issue 9 years ago • 1 comments
trafficstars

看到一个提示:

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';

看了一下你的代码,好像就是有这个问题:import React from 'react-native';

wind13 avatar Aug 27 '16 11:08 wind13

修改了 import 后,再试看到这个错:

ExceptionsManager.js:61
Cannot read property 'RCTBaiduMap' of undefined

之后尝试改为这样就可以:

// import React from 'react-native';
var React = require('react');
var ReactNative = require('react-native');

wind13 avatar Aug 27 '16 11:08 wind13