react-native-baidumap

android ios

android ios

Installation

First you need to install react-native-baidumapkit:

$ npm install react-native-baidumapkit --save

Add Configuration link

($ npm install rnpm --global)
$ rnpm link react-native-baidumapkit

If the link fails, manually add

settings.gradle

include ':react-native-baidumapkit'
project(':react-native-baidumapkit').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-baidumapkit/android')

build.gradle

 dependencies {
    ...
    compile project(':react-native-baidumapkit')
}

MainActivity

import com.bee.baidumapview.BaiduMapModuleReactPackage;
 @Override
    protected List<ReactPackage> getPackages() {
        return Arrays.<ReactPackage>asList(
                ...
                new BaiduMapModuleReactPackage(),
                new BaiduMapReactPackage(this),
               );

    }

Release Notes

  • 1.0.0

Example

import BDMapModule from ('react-native-baidumapkit/BDMapModule');
import BDMapView from ('react-native-baidumapkit');

<BDMapView style={styles.mapViewStyle}
                       ref={'locationMap'}
                       isEnableClicked={true}
                       range={this.state.range}
                />
 let value = {
                "baidu_latitude"    :this.props["baidu_latitude"],
                "baidu_longitude"   :this.props["baidu_longitude"],
                "avatar"            :this.props.avatar
            }
BDMapModule.setLocation(React.findNodeHandle(this.refs.locationMap),value);
BDMapModule.setLocationAnimation(React.findNodeHandle(this.refs.locationMap),value);
BDMapModule.setRuler(React.findNodeHandle(this.refs.locationMap),20);         

other....