dwd-fe / react-native-amap

React Native AMap component for iOS + Android
MIT License
87 stars 25 forks source link
amap gaode react-native

react-native-amap

React Native AMap component for iOS + Android

react-native-amap-view is a wrapper of AMap's Libraries inspired by react-native-maps and it's usable in Android and iOS

Demo

demo-gif

Installation

npm install react-native-amap-view --save

iOS

Only test on react-native 0.29

Android


## Usage

import AMapView from 'react-native-amap-view'

render(){ return (<View style={{flex: 1, backgroundColor: '#f00'}}> <AMapView initialRegion={{latitude: 30.315888, longitude: 120.165817}} showsUserLocation> <AMapView.Marker pinColor="green" draggable title='xxx' description="这是一个好地方" coordinate={{latitude: 30.315888, longitude: 120.165817}} /> ); }



ATTENTION: Make sure that the ancestor containers of AMapView is flexed, otherwise you will see an empty view!

### User Location
Dont use the `showsUserLocation` property for it has some bugs. 
Instead, use `geolocation` in iOS and [react-native-amap-location](https://github.com/xiaobuu/react-native-amap-location) in android.
Then render a new marker for the user location.