Skip to content

Commit

Permalink
Update reverseGeoCode callback
Browse files Browse the repository at this point in the history
  • Loading branch information
lovebing committed Oct 28, 2016
1 parent 227b950 commit 05ed3e7
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ project(':react-native-baidu-map').projectDir = new File(settingsDir, '../node_m

| Method | Result
| ------------------------- | -------
| Promise reverseGeoCode(double lat, double lng) | {"address": ""}
| Promise reverseGeoCodeGPS(double lat, double lng) | {"address": ""}
| Promise reverseGeoCode(double lat, double lng) | `{"address": "", "province": "", "city": "", "district": "", "streetName": "", "streetNumber": ""}`
| Promise reverseGeoCodeGPS(double lat, double lng) | `{"address": "", "province": "", "city": "", "district": "", "streetName": "", "streetNumber": ""}`
| Promise geocode(String city, String addr) | {"latitude": 0.0, "longitude": 0.0}
| Promise getCurrentPosition() | IOS: `{"latitude": 0.0, "longitude": 0.0}` Android: `{"latitude": 0.0, "longitude": 0.0, "direction": -1, "altitude": 0.0, "radius": 0.0, "address": "", "countryCode": "", "country": "", "province": "", "cityCode": "", "city": "", "district": "", "street": "", "streetNumber": "", "buildingId": "", "buildingName": ""}`
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,13 @@ public void onGetReverseGeoCodeResult(ReverseGeoCodeResult result) {
params.putInt("errcode", -1);
}
else {
params.putString("address", result.getAddress());
ReverseGeoCodeResult.AddressComponent addressComponent = result.getAddressDetail();
params.putString("address", result.getAddress());
params.putString("province", addressComponent.province);
params.putString("city", addressComponent.city);
params.putString("district", addressComponent.district);
params.putString("street", addressComponent.street);
params.putString("streetNumber", addressComponent.streetNumber);
}
sendEvent("onGetReverseGeoCodeResult", params);
}
Expand Down
2 changes: 1 addition & 1 deletion demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"dependencies": {
"react": "15.2.1",
"react-native": "^0.30.0",
"react-native-baidu-map": "^0.4.7"
"react-native-baidu-map": "^0.4.8"
}
}
5 changes: 5 additions & 0 deletions ios/RCTBaiduMap/GeolocationModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ -(void) onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKRevers

if (error == BMK_SEARCH_NO_ERROR) {
body[@"address"] = result.address;
body[@"province"] = result.addressDetail.province;
body[@"city"] = result.addressDetail.city;
body[@"district"] = result.addressDetail.district;
body[@"streetName"] = result.addressDetail.streetName;
body[@"streetNumber"] = result.addressDetail.streetNumber;
}
else {
body[@"errcode"] = [NSString stringWithFormat:@"%d", error];
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-baidu-map",
"version": "0.4.7",
"version": "0.4.8",
"description": "Baidu Map SDK modules and view for React Native(Android & IOS), support react native 0.30+.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 05ed3e7

Please sign in to comment.