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

this.refs["mapView"].zoomToLocs([[x, y]])报错

Open smoothdvd opened this issue 9 years ago • 1 comments

undefined is not a function (evaluating '_react2.default.findNodeHandle(this.refs["baiduMap"])')

是原因导致的?不执行这句的话,可以显示默认的北京地区地图。

smoothdvd avatar Jul 17 '16 05:07 smoothdvd

Get answer:

With new react-native, should:

import {
    ...,
    findNodeHandle,
    ...,
} from 'react-native';

...
UIManager.dispatchViewManagerCommand(
          findNodeHandle(this.refs["baiduMap"]),
          UIManager.RCTBaiduMap.Commands.zoomToLocs,
          [locs]
      );
...

smoothdvd avatar Jul 17 '16 06:07 smoothdvd