react-native-maps 1.21.0-alpha.59 → 1.21.0-alpha.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
package com.rnmaps.fabric;
|
|
2
2
|
|
|
3
3
|
import com.facebook.fbreact.specs.NativeAirMapsModuleSpec;
|
|
4
|
+
import com.facebook.react.bridge.Arguments;
|
|
4
5
|
import com.facebook.react.bridge.Promise;
|
|
5
6
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
7
|
import com.facebook.react.bridge.ReadableMap;
|
|
8
|
+
import com.facebook.react.bridge.UIManager;
|
|
9
|
+
import com.facebook.react.bridge.WritableMap;
|
|
10
|
+
import com.facebook.react.uimanager.UIManagerHelper;
|
|
11
|
+
import com.google.android.gms.maps.model.CameraPosition;
|
|
12
|
+
import com.rnmaps.maps.MapView;
|
|
7
13
|
|
|
8
14
|
public class NativeAirMapsModule extends NativeAirMapsModuleSpec {
|
|
9
15
|
public NativeAirMapsModule(ReactApplicationContext reactContext) {
|
|
@@ -17,7 +23,23 @@ public class NativeAirMapsModule extends NativeAirMapsModuleSpec {
|
|
|
17
23
|
|
|
18
24
|
@Override
|
|
19
25
|
public void getCamera(double tag, Promise promise) {
|
|
20
|
-
|
|
26
|
+
UIManager uiManager = UIManagerHelper.getUIManagerForReactTag(getReactApplicationContext(), (int) tag);
|
|
27
|
+
getReactApplicationContext().runOnUiQueueThread(new Runnable() {
|
|
28
|
+
@Override
|
|
29
|
+
public void run() {
|
|
30
|
+
MapView view = (MapView) uiManager.resolveView((int) tag);
|
|
31
|
+
CameraPosition position = view.map.getCameraPosition();
|
|
32
|
+
WritableMap map = Arguments.createMap();
|
|
33
|
+
WritableMap center = Arguments.createMap();
|
|
34
|
+
center.putDouble("latitude", position.target.latitude);
|
|
35
|
+
center.putDouble("longitude", position.target.longitude);
|
|
36
|
+
map.putMap("center", center);
|
|
37
|
+
map.putDouble("heading", position.bearing);
|
|
38
|
+
map.putDouble("pitch", position.tilt);
|
|
39
|
+
map.putDouble("zoom", position.zoom);
|
|
40
|
+
promise.resolve(map);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
21
43
|
}
|
|
22
44
|
|
|
23
45
|
@Override
|
package/lib/MapView.js
CHANGED
|
@@ -88,13 +88,8 @@ class MapView extends React.Component {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
getCamera() {
|
|
91
|
-
if (
|
|
92
|
-
return
|
|
93
|
-
}
|
|
94
|
-
else if (react_native_1.Platform.OS === 'ios') {
|
|
95
|
-
if (this.fabricMap.current) {
|
|
96
|
-
return this.fabricMap.current.getCamera();
|
|
97
|
-
}
|
|
91
|
+
if (this.fabricMap.current) {
|
|
92
|
+
return this.fabricMap.current.getCamera();
|
|
98
93
|
}
|
|
99
94
|
return Promise.reject('getCamera not supported on this platform');
|
|
100
95
|
}
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.21.0-alpha.
|
|
8
|
+
"version": "1.21.0-alpha.60",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|