Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 24 additions & 0 deletions RCTBaiduMap.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'json'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

Pod::Spec.new do |s|
s.name = 'RCTBaiduMap'
s.version = package['version'].gsub(/v|-beta/, '')
s.summary = package['description']
s.author = package['author']
s.license = package['license']
s.homepage = package['homepage']

s.platform = :ios, "9.0"

s.source = { :git => "https://github.com/futurechallenger/react-native-baidu-map.git", :tag => "#{s.version}" }
s.source_files = "ios/RCTBaiduMap/*.{h,m}"
s.public_header_files = "ios/RCTBaiduMap/*.h"

s.ios.deployment_target = '9.0'
s.preserve_paths = '*.js'

s.dependency 'BaiduMapKit'

end
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# react-native-baidu-map [![npm version](https://img.shields.io/npm/v/react-native-baidu-map.svg?style=flat)](https://www.npmjs.com/package/react-native-baidu-map)

Baidu Map SDK modules and view for React Native(Android & IOS), support react native 0.40+
Baidu Map SDK modules and view for React Native(Android & IOS), support react native 0.30+

百度地图 React Native 模块,支持 react native 0.40+
百度地图 React Native 模块,支持 react native 0.30+

![Android](https://raw.githubusercontent.com/lovebing/react-native-baidu-map/master/images/android.jpg)
![IOS](https://raw.githubusercontent.com/lovebing/react-native-baidu-map/master/images/ios.jpg)
Expand All @@ -23,6 +23,11 @@ project(':react-native-baidu-map').projectDir = new File(settingsDir, '../node_m
android:name="com.baidu.lbsapi.API_KEY" android:value="xx"/>`

#### Xcode
iOS的导入方式有两种:
1. 通过项目中的`Podfile`来实现自动导入。这个可以在*demo*目录中找到示例`Podfile`。**注意**:这样是全量的导入了百度地图的SDK。如果开发者不需要全部的地图功能的话可以根据[这个文档](http://lbsyun.baidu.com/index.php?title=iossdk/guide/create-project/oc)适导入合适的库。

2. 手动导入。也可以参考[百度地图的文档](http://lbsyun.baidu.com/index.php?title=iossdk/guide/create-project/oc)来一步一步的导入。

- Project navigator->Libraries->Add Files to 选择 react-native-baidu-map/ios/RCTBaiduMap.xcodeproj
- Project navigator->Build Phases->Link Binary With Libraries 加入 libRCTBaiduMap.a
- Project navigator->Build Settings->Search Paths, Framework search paths 添加 react-native-baidu-map/ios/lib,Header search paths 添加 react-native-baidu-map/ios/RCTBaiduMap
Expand Down
File renamed without changes.
97 changes: 39 additions & 58 deletions demo/android/app/app.iml → android/react-native-baidu-map.iml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package org.lovebing.reactnative.baidumap;

import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;

/**
* Created by lovebing on 1/30/2016.
*/
public class BaiduMapModule extends BaseModule {

private static final String REACT_CLASS = "BaiduMapModule";
public BaiduMapModule(ReactApplicationContext reactContext) {
super(reactContext);
context = reactContext;
}
private static final String REACT_CLASS = "BaiduMapModule";

public String getName() {
return REACT_CLASS;
}
public BaiduMapModule(ReactApplicationContext reactContext) {
super(reactContext);
// context = reactContext;
}

public String getName() {
return REACT_CLASS;
}
}
Original file line number Diff line number Diff line change
@@ -1,53 +1,47 @@
package org.lovebing.reactnative.baidumap;

import android.app.Activity;
import android.content.Context;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;

import com.facebook.react.uimanager.ViewManager;
import java.util.Arrays;
import java.util.List;


/**
* Created by lovebing on 4/17/16.
*/
public class BaiduMapPackage implements ReactPackage {

private Context mContext;

BaiduMapViewManager baiduMapViewManager;

public BaiduMapPackage(Context context) {
this.mContext = context;
baiduMapViewManager = new BaiduMapViewManager();
baiduMapViewManager.initSDK(context);
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.<NativeModule>asList(
new BaiduMapModule(reactContext),
new GeolocationModule(reactContext)
);
}

@Override
public List<ViewManager> createViewManagers(
ReactApplicationContext reactContext) {
return Arrays.<ViewManager>asList(
baiduMapViewManager
);
}

// Deprecated RN 0.47
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
private Context mContext;

BaiduMapViewManager baiduMapViewManager;

public BaiduMapPackage(Context context) {
this.mContext = context;
baiduMapViewManager = new BaiduMapViewManager();
baiduMapViewManager.initSDK(context);
}

@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
return Arrays.<NativeModule>asList(
new BaiduMapModule(reactContext),
new GeolocationModule(reactContext)
);
}

@Override
public List<ViewManager> createViewManagers(
ReactApplicationContext reactContext) {
return Arrays.<ViewManager>asList(
baiduMapViewManager
);
}

// @Override
// public List<Class<? extends JavaScriptModule>> createJSModules() {
// return Collections.emptyList();
// }
}
Loading