1.1.1 • Published 4 years ago
react-native-arena-map v1.1.1
react-native-arena-map
Getting started
$ npm install react-native-arena-map --save
Mostly automatic installation
$ react-native link react-native-arena-map
配置
iOS
- 在info.plist 中添加地理位置权限Privacy - Location When In Use Usage Description
- 把ios文件夹下的source 和 framework 两个文件夹,导入主工程
- 添加高德德图的库的依赖,分别为CoreTelephony.framework,CoreLocation.framework,SystemConfiguration.framework,Security.framework,libz.tbd,libc++.tbd,GLKit.framework,ExternalAccessory.framework,
Android
- 报32位64位冲突,在app.gradel中配置
defaultConfig {
ndk {
abiFilters "armeabi", "armeabi-v7a", "x86", "mips"
}
}
<!--在app/src/main/AndroidManifest.xml 中加入高德appKey-->
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="58d28b59f3da0075c246e0ec372e9980" />
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-arena-map
and addRNArenaMap.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNArenaMap.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.dingle.map.RNArenaMapPackage;
to the imports at the top of the file - Add
new RNArenaMapPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-arena-map' project(':react-native-arena-map').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-arena-map/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-arena-map')
Usage
import RNArenaMap from 'react-native-arena-map';
// TODO: What to do with the module?
RNArenaMap.showLocationSelectMapview().then((data)=>{
<!--成功-->
},(error)=>{
<!--失败-->
})