react-native-map4d-map-dtqg 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +41 -0
- package/android/build.gradle +60 -0
- package/android/src/main/AndroidManifest.xml +4 -0
- package/android/src/main/java/com/reactnativemap4dmap/ImageUtils.java +87 -0
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapModule.java +298 -0
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapPackage.java +35 -0
- package/android/src/main/java/com/reactnativemap4dmap/Map4dMapViewManager.java +31 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuilding.java +167 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFBuildingManager.java +121 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircle.java +105 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFCircleManager.java +122 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRenderer.java +502 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFDirectionsRendererManager.java +143 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFFeature.java +18 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapView.java +1172 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMapViewManager.java +226 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarker.java +412 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFMarkerManager.java +212 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOI.java +222 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPOIManager.java +119 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygon.java +173 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolygonManager.java +148 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolyline.java +146 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFPolylineManager.java +138 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlay.java +95 -0
- package/android/src/main/java/com/reactnativemap4dmap/RMFTileOverlayManager.java +65 -0
- package/android/src/main/java/com/reactnativemap4dmap/SizeReportingShadowNode.java +31 -0
- package/android/src/main/java/com/reactnativemap4dmap/ViewAttacherGroup.java +31 -0
- package/android/src/main/java/com/reactnativemap4dmap/ViewChangesTracker.java +70 -0
- package/android/src/main/java/vn/map4d/map/annotations/RMFBitmapDescriptor.java +9 -0
- package/ios/Map4dMap.h +7 -0
- package/ios/Map4dMap.m +14 -0
- package/ios/Map4dMap.xcodeproj/project.pbxproj +282 -0
- package/ios/Map4dMapViewManager.m +34 -0
- package/ios/RCTConvert+Map4dMap.h +33 -0
- package/ios/RCTConvert+Map4dMap.m +112 -0
- package/ios/RMFCircle.h +37 -0
- package/ios/RMFCircle.m +100 -0
- package/ios/RMFCircleManager.h +18 -0
- package/ios/RMFCircleManager.m +155 -0
- package/ios/RMFCircleMap4d.h +23 -0
- package/ios/RMFCircleMap4d.m +13 -0
- package/ios/RMFCoordinate.h +22 -0
- package/ios/RMFCoordinate.m +13 -0
- package/ios/RMFDirectionsMarkerOptions.h +24 -0
- package/ios/RMFDirectionsMarkerOptions.m +23 -0
- package/ios/RMFDirectionsRenderer.h +47 -0
- package/ios/RMFDirectionsRenderer.m +182 -0
- package/ios/RMFDirectionsRendererManager.h +17 -0
- package/ios/RMFDirectionsRendererManager.m +84 -0
- package/ios/RMFDirectionsRendererMap4d.h +21 -0
- package/ios/RMFDirectionsRendererMap4d.m +12 -0
- package/ios/RMFDummyView.h +7 -0
- package/ios/RMFDummyView.m +13 -0
- package/ios/RMFEventResponse.h +39 -0
- package/ios/RMFEventResponse.m +98 -0
- package/ios/RMFIcon.h +24 -0
- package/ios/RMFIcon.m +35 -0
- package/ios/RMFMapView.h +84 -0
- package/ios/RMFMapView.m +376 -0
- package/ios/RMFMapViewManager.h +17 -0
- package/ios/RMFMapViewManager.m +493 -0
- package/ios/RMFMarker.h +57 -0
- package/ios/RMFMarker.m +267 -0
- package/ios/RMFMarkerManager.h +17 -0
- package/ios/RMFMarkerManager.m +156 -0
- package/ios/RMFMarkerMap4d.h +19 -0
- package/ios/RMFMarkerMap4d.m +13 -0
- package/ios/RMFPOI.h +38 -0
- package/ios/RMFPOI.m +123 -0
- package/ios/RMFPOIManager.h +18 -0
- package/ios/RMFPOIManager.m +168 -0
- package/ios/RMFPOIMap4d.h +22 -0
- package/ios/RMFPOIMap4d.m +12 -0
- package/ios/RMFPolygon.h +41 -0
- package/ios/RMFPolygon.m +106 -0
- package/ios/RMFPolygonManager.h +18 -0
- package/ios/RMFPolygonManager.m +141 -0
- package/ios/RMFPolygonMap4d.h +23 -0
- package/ios/RMFPolygonMap4d.m +15 -0
- package/ios/RMFPolyline.h +38 -0
- package/ios/RMFPolyline.m +101 -0
- package/ios/RMFPolylineManager.h +18 -0
- package/ios/RMFPolylineManager.m +139 -0
- package/ios/RMFPolylineMap4d.h +22 -0
- package/ios/RMFPolylineMap4d.m +15 -0
- package/ios/building/RMFBuilding.h +41 -0
- package/ios/building/RMFBuilding.m +104 -0
- package/ios/building/RMFBuildingManager.h +19 -0
- package/ios/building/RMFBuildingManager.m +133 -0
- package/ios/building/RMFBuildingMap4d.h +23 -0
- package/ios/building/RMFBuildingMap4d.m +15 -0
- package/ios/overlays/RMFTileOverlay.h +36 -0
- package/ios/overlays/RMFTileOverlay.m +64 -0
- package/ios/overlays/RMFTileOverlayManager.h +17 -0
- package/ios/overlays/RMFTileOverlayManager.m +27 -0
- package/lib/commonjs/components/MFBuilding.js +192 -0
- package/lib/commonjs/components/MFBuilding.js.map +1 -0
- package/lib/commonjs/components/MFCircle.js +181 -0
- package/lib/commonjs/components/MFCircle.js.map +1 -0
- package/lib/commonjs/components/MFDirectionsRenderer.js +240 -0
- package/lib/commonjs/components/MFDirectionsRenderer.js.map +1 -0
- package/lib/commonjs/components/MFMapView.js +375 -0
- package/lib/commonjs/components/MFMapView.js.map +1 -0
- package/lib/commonjs/components/MFMarker.js +255 -0
- package/lib/commonjs/components/MFMarker.js.map +1 -0
- package/lib/commonjs/components/MFPOI.js +204 -0
- package/lib/commonjs/components/MFPOI.js.map +1 -0
- package/lib/commonjs/components/MFPolygon.js +183 -0
- package/lib/commonjs/components/MFPolygon.js.map +1 -0
- package/lib/commonjs/components/MFPolyline.js +173 -0
- package/lib/commonjs/components/MFPolyline.js.map +1 -0
- package/lib/commonjs/components/MFTileOverlay.js +51 -0
- package/lib/commonjs/components/MFTileOverlay.js.map +1 -0
- package/lib/commonjs/components/Map4dMapView.js +19 -0
- package/lib/commonjs/components/Map4dMapView.js.map +1 -0
- package/lib/commonjs/index.js +78 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/components/MFBuilding.js +178 -0
- package/lib/module/components/MFBuilding.js.map +1 -0
- package/lib/module/components/MFCircle.js +167 -0
- package/lib/module/components/MFCircle.js.map +1 -0
- package/lib/module/components/MFDirectionsRenderer.js +226 -0
- package/lib/module/components/MFDirectionsRenderer.js.map +1 -0
- package/lib/module/components/MFMapView.js +361 -0
- package/lib/module/components/MFMapView.js.map +1 -0
- package/lib/module/components/MFMarker.js +240 -0
- package/lib/module/components/MFMarker.js.map +1 -0
- package/lib/module/components/MFPOI.js +190 -0
- package/lib/module/components/MFPOI.js.map +1 -0
- package/lib/module/components/MFPolygon.js +169 -0
- package/lib/module/components/MFPolygon.js.map +1 -0
- package/lib/module/components/MFPolyline.js +159 -0
- package/lib/module/components/MFPolyline.js.map +1 -0
- package/lib/module/components/MFTileOverlay.js +38 -0
- package/lib/module/components/MFTileOverlay.js.map +1 -0
- package/lib/module/components/Map4dMapView.js +10 -0
- package/lib/module/components/Map4dMapView.js.map +1 -0
- package/lib/module/index.js +11 -0
- package/lib/module/index.js.map +1 -0
- package/lib/typescript/components/Map4dMapView.d.ts +7 -0
- package/package.json +152 -0
- package/react-native-map4d-map.podspec +20 -0
- package/src/components/MFBuilding.js +188 -0
- package/src/components/MFCircle.js +173 -0
- package/src/components/MFDirectionsRenderer.js +237 -0
- package/src/components/MFMapView.js +374 -0
- package/src/components/MFMarker.js +246 -0
- package/src/components/MFPOI.js +184 -0
- package/src/components/MFPolygon.js +186 -0
- package/src/components/MFPolyline.js +172 -0
- package/src/components/MFTileOverlay.js +45 -0
- package/src/components/Map4dMapView.tsx +27 -0
- package/src/index.js +21 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { ViewPropTypes, ColorPropType } from 'deprecated-react-native-prop-types';
|
|
6
|
+
import { requireNativeComponent, Platform, NativeModules, findNodeHandle, processColor } from 'react-native'; // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
|
|
7
|
+
|
|
8
|
+
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
9
|
+
const propTypes = { ...viewPropTypes,
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* An array of coordinates to describe the polyline
|
|
13
|
+
*/
|
|
14
|
+
coordinates: PropTypes.arrayOf(PropTypes.shape({
|
|
15
|
+
/**
|
|
16
|
+
* Latitude/Longitude coordinates
|
|
17
|
+
*/
|
|
18
|
+
latitude: PropTypes.number.isRequired,
|
|
19
|
+
longitude: PropTypes.number.isRequired
|
|
20
|
+
})),
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The color to use for the path.
|
|
24
|
+
*/
|
|
25
|
+
color: ColorPropType,
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The stroke width to use for the path.
|
|
29
|
+
*/
|
|
30
|
+
width: PropTypes.number,
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The default style is `solid`.
|
|
34
|
+
*/
|
|
35
|
+
lineStyle: PropTypes.oneOf(['solid', 'dotted']),
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* zIndex
|
|
39
|
+
*/
|
|
40
|
+
zIndex: PropTypes.number,
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* visible
|
|
44
|
+
*/
|
|
45
|
+
visible: PropTypes.bool,
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* userData
|
|
49
|
+
*/
|
|
50
|
+
userData: PropTypes.object,
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Callback that is called when the user presses on the polyline
|
|
54
|
+
*/
|
|
55
|
+
onPress: PropTypes.func
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
class MFPolyline extends React.Component {
|
|
59
|
+
constructor(props) {
|
|
60
|
+
super(props);
|
|
61
|
+
this._onPress = this._onPress.bind(this);
|
|
62
|
+
this._ref = this._ref.bind(this);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_onPress(event) {
|
|
66
|
+
event.stopPropagation();
|
|
67
|
+
|
|
68
|
+
if (this.props.onPress) {
|
|
69
|
+
this.props.onPress(event);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
_ref(ref) {
|
|
74
|
+
this.polyline = ref;
|
|
75
|
+
} // TODO - bug
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
setCoordinates(coordinates) {
|
|
79
|
+
this._runCommand("setCoordinates", [coordinates]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
setWidth(width) {
|
|
83
|
+
this._runCommand("setWidth", [width]);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
setColor(color) {
|
|
87
|
+
this._runCommand("setColor", [processColor(color)]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
setVisible(visible) {
|
|
91
|
+
this._runCommand("setVisible", [visible]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
setTouchable(touchable) {
|
|
95
|
+
this._runCommand("setTouchable", [touchable]);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
setZIndex(zIndex) {
|
|
99
|
+
this._runCommand("setZIndex", [zIndex]);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
setLineStyle(style) {
|
|
103
|
+
this._runCommand("setLineStyle", [style]);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
setUserData(userData) {
|
|
107
|
+
this._runCommand("setUserData", [userData]);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_getHandle() {
|
|
111
|
+
return findNodeHandle(this.polyline);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
_runCommand(name, args) {
|
|
115
|
+
switch (Platform.OS) {
|
|
116
|
+
case 'android':
|
|
117
|
+
NativeModules.UIManager.dispatchViewManagerCommand(this._getHandle(), this._uiManagerCommand(name), args);
|
|
118
|
+
break;
|
|
119
|
+
|
|
120
|
+
case 'ios':
|
|
121
|
+
this._mapManagerCommand(name)(this._getHandle(), ...args);
|
|
122
|
+
|
|
123
|
+
break;
|
|
124
|
+
|
|
125
|
+
default:
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
_uiManagerCommand(name) {
|
|
131
|
+
const UIManager = NativeModules.UIManager;
|
|
132
|
+
const componentName = "RMFPolyline";
|
|
133
|
+
|
|
134
|
+
if (!UIManager.getViewManagerConfig) {
|
|
135
|
+
// RN < 0.58
|
|
136
|
+
return UIManager[componentName].Commands[name];
|
|
137
|
+
} // RN >= 0.58
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
return UIManager.getViewManagerConfig(componentName).Commands[name];
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
_mapManagerCommand(name) {
|
|
144
|
+
return NativeModules[`RMFPolyline`][name];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
render() {
|
|
148
|
+
return /*#__PURE__*/React.createElement(RMFPolyline, _extends({}, this.props, {
|
|
149
|
+
ref: this._ref,
|
|
150
|
+
onPress: this._onPress
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
MFPolyline.propTypes = propTypes;
|
|
157
|
+
var RMFPolyline = requireNativeComponent(`RMFPolyline`, MFPolyline);
|
|
158
|
+
export { MFPolyline };
|
|
159
|
+
//# sourceMappingURL=MFPolyline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","PropTypes","ViewPropTypes","ColorPropType","requireNativeComponent","Platform","NativeModules","findNodeHandle","processColor","viewPropTypes","View","propTypes","coordinates","arrayOf","shape","latitude","number","isRequired","longitude","color","width","lineStyle","oneOf","zIndex","visible","bool","userData","object","onPress","func","MFPolyline","Component","constructor","props","_onPress","bind","_ref","event","stopPropagation","ref","polyline","setCoordinates","_runCommand","setWidth","setColor","setVisible","setTouchable","touchable","setZIndex","setLineStyle","style","setUserData","_getHandle","name","args","OS","UIManager","dispatchViewManagerCommand","_uiManagerCommand","_mapManagerCommand","componentName","getViewManagerConfig","Commands","render","RMFPolyline"],"sources":["MFPolyline.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport {ViewPropTypes, ColorPropType} from 'deprecated-react-native-prop-types';\nimport {\n requireNativeComponent,\n Platform,\n NativeModules,\n findNodeHandle,\n processColor\n} from 'react-native';\n\n// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)\nconst viewPropTypes = ViewPropTypes || View.propTypes;\n\nconst propTypes = {\n ...viewPropTypes,\n\n /**\n * An array of coordinates to describe the polyline\n */\n coordinates: PropTypes.arrayOf(\n PropTypes.shape({\n /**\n * Latitude/Longitude coordinates\n */\n latitude: PropTypes.number.isRequired,\n longitude: PropTypes.number.isRequired,\n })\n ),\n\n /**\n * The color to use for the path.\n */\n color: ColorPropType,\n\n /**\n * The stroke width to use for the path.\n */\n width: PropTypes.number,\n\n /**\n * The default style is `solid`.\n */\n lineStyle: PropTypes.oneOf(['solid', 'dotted']),\n\n /**\n * zIndex\n */\n zIndex: PropTypes.number,\n\n /**\n * visible\n */\n visible: PropTypes.bool,\n\n /**\n * userData\n */\n userData:PropTypes.object,\n\n /**\n * Callback that is called when the user presses on the polyline\n */\n onPress: PropTypes.func,\n};\n\n\nclass MFPolyline extends React.Component {\n constructor(props) {\n super(props);\n this._onPress = this._onPress.bind(this)\n this._ref = this._ref.bind(this)\n }\n\n _onPress(event) {\n event.stopPropagation();\n if (this.props.onPress) {\n this.props.onPress(event);\n }\n }\n\n _ref(ref) {\n this.polyline = ref;\n }\n\n // TODO - bug\n setCoordinates(coordinates) {\n this._runCommand(\"setCoordinates\", [coordinates])\n }\n\n setWidth(width) {\n this._runCommand(\"setWidth\", [width])\n }\n\n setColor(color) {\n this._runCommand(\"setColor\", [processColor(color)])\n }\n\n setVisible(visible) {\n this._runCommand(\"setVisible\", [visible])\n }\n\n setTouchable(touchable) {\n this._runCommand(\"setTouchable\", [touchable])\n }\n\n setZIndex(zIndex) {\n this._runCommand(\"setZIndex\", [zIndex])\n }\n\n setLineStyle(style) {\n this._runCommand(\"setLineStyle\", [style])\n }\n\n setUserData(userData) {\n this._runCommand(\"setUserData\", [userData])\n }\n\n _getHandle() {\n return findNodeHandle(this.polyline);\n }\n\n _runCommand(name, args) {\n switch (Platform.OS) {\n case 'android':\n NativeModules.UIManager.dispatchViewManagerCommand(\n this._getHandle(),\n this._uiManagerCommand(name),\n args\n );\n break;\n\n case 'ios':\n this._mapManagerCommand(name)(this._getHandle(), ...args);\n break;\n\n default:\n break;\n }\n }\n\n _uiManagerCommand(name) {\n const UIManager = NativeModules.UIManager;\n const componentName = \"RMFPolyline\";\n\n if (!UIManager.getViewManagerConfig) {\n // RN < 0.58\n return UIManager[componentName].Commands[name];\n }\n\n // RN >= 0.58 \n return UIManager.getViewManagerConfig(componentName).Commands[name];\n }\n\n _mapManagerCommand(name) {\n return NativeModules[`RMFPolyline`][name];\n }\n\n render() {\n return <RMFPolyline\n {...this.props}\n ref={this._ref}\n onPress={this._onPress}\n />;\n }\n}\n\nMFPolyline.propTypes = propTypes;\n\nvar RMFPolyline = requireNativeComponent(`RMFPolyline`, MFPolyline);\n\nexport { MFPolyline }\n"],"mappings":"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"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import PropTypes from "prop-types";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { ViewPropTypes } from 'deprecated-react-native-prop-types';
|
|
4
|
+
import { requireNativeComponent, View } from 'react-native'; // if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
|
|
5
|
+
|
|
6
|
+
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
7
|
+
const propTypes = { ...viewPropTypes,
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime
|
|
11
|
+
* For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png
|
|
12
|
+
*/
|
|
13
|
+
urlTemplate: PropTypes.string.isRequired,
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* visible
|
|
17
|
+
*/
|
|
18
|
+
visible: PropTypes.bool,
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
|
|
22
|
+
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
|
|
23
|
+
* with the same z-index is arbitrary. The default zIndex is 0.
|
|
24
|
+
*/
|
|
25
|
+
zIndex: PropTypes.number
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
class MFTileOverlay extends React.Component {
|
|
29
|
+
render() {
|
|
30
|
+
return /*#__PURE__*/React.createElement(RMFTileOverlay, this.props);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
MFTileOverlay.propTypes = propTypes;
|
|
36
|
+
var RMFTileOverlay = requireNativeComponent(`RMFTileOverlay`, MFTileOverlay);
|
|
37
|
+
export { MFTileOverlay };
|
|
38
|
+
//# sourceMappingURL=MFTileOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["PropTypes","React","ViewPropTypes","requireNativeComponent","View","viewPropTypes","propTypes","urlTemplate","string","isRequired","visible","bool","zIndex","number","MFTileOverlay","Component","render","props","RMFTileOverlay"],"sources":["MFTileOverlay.js"],"sourcesContent":["import PropTypes from \"prop-types\";\nimport React from 'react';\nimport {ViewPropTypes} from 'deprecated-react-native-prop-types';\nimport {\n requireNativeComponent,\n View,\n} from 'react-native';\n\n// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)\nconst viewPropTypes = ViewPropTypes || View.propTypes;\nconst propTypes = {\n ...viewPropTypes,\n\n /**\n * The url template of the tile server. The patterns {x} {y} {z} will be replaced at runtime\n * For example, https://tile.openstreetmap.de/{z}/{x}/{y}.png\n */\n urlTemplate: PropTypes.string.isRequired,\n\n /**\n * visible\n */\n visible: PropTypes.bool,\n\n /**\n * The order in which this tile overlay is drawn with respect to other overlays. An overlay\n * with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays\n * with the same z-index is arbitrary. The default zIndex is 0.\n */\n zIndex: PropTypes.number,\n};\n\nclass MFTileOverlay extends React.Component {\n render() {\n return <RMFTileOverlay\n {...this.props}\n />;\n }\n}\n\nMFTileOverlay.propTypes = propTypes;\n\nvar RMFTileOverlay = requireNativeComponent(`RMFTileOverlay`, MFTileOverlay);\n\nexport { MFTileOverlay }\n"],"mappings":"AAAA,OAAOA,SAAP,MAAsB,YAAtB;AACA,OAAOC,KAAP,MAAkB,OAAlB;AACA,SAAQC,aAAR,QAA4B,oCAA5B;AACA,SACEC,sBADF,EAEEC,IAFF,QAGO,cAHP,C,CAKA;;AACA,MAAMC,aAAa,GAAGH,aAAa,IAAIE,IAAI,CAACE,SAA5C;AACA,MAAMA,SAAS,GAAG,EAChB,GAAGD,aADa;;EAGhB;AACF;AACA;AACA;EACEE,WAAW,EAAEP,SAAS,CAACQ,MAAV,CAAiBC,UAPd;;EAShB;AACF;AACA;EACEC,OAAO,EAAEV,SAAS,CAACW,IAZH;;EAchB;AACF;AACA;AACA;AACA;EACEC,MAAM,EAAEZ,SAAS,CAACa;AAnBF,CAAlB;;AAsBA,MAAMC,aAAN,SAA4Bb,KAAK,CAACc,SAAlC,CAA4C;EAC1CC,MAAM,GAAG;IACP,oBAAO,oBAAC,cAAD,EACD,KAAKC,KADJ,CAAP;EAGD;;AALyC;;AAQ5CH,aAAa,CAACR,SAAd,GAA0BA,SAA1B;AAEA,IAAIY,cAAc,GAAGf,sBAAsB,CAAE,gBAAF,EAAmBW,aAAnB,CAA3C;AAEA,SAASA,aAAT"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { requireNativeComponent, UIManager, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'react-native-map4d-map' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
6
|
+
const ComponentName = 'Map4dMapView';
|
|
7
|
+
export const Map4dMapView = UIManager.getViewManagerConfig(ComponentName) != null ? requireNativeComponent(ComponentName) : () => {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=Map4dMapView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["requireNativeComponent","UIManager","Platform","LINKING_ERROR","select","ios","default","ComponentName","Map4dMapView","getViewManagerConfig","Error"],"sources":["Map4dMapView.tsx"],"sourcesContent":["import {\n requireNativeComponent,\n UIManager,\n Platform,\n ViewStyle,\n } from 'react-native';\n \n const LINKING_ERROR =\n `The package 'react-native-map4d-map' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n \n type Map4dMapProps = {\n color: string;\n style: ViewStyle;\n };\n \n const ComponentName = 'Map4dMapView';\n \n export const Map4dMapView =\n UIManager.getViewManagerConfig(ComponentName) != null\n ? requireNativeComponent<Map4dMapProps>(ComponentName)\n : () => {\n throw new Error(LINKING_ERROR);\n };\n "],"mappings":"AAAA,SACIA,sBADJ,EAEIC,SAFJ,EAGIC,QAHJ,QAKS,cALT;AAOE,MAAMC,aAAa,GAChB,iFAAD,GACAD,QAAQ,CAACE,MAAT,CAAgB;EAAEC,GAAG,EAAE,gCAAP;EAAyCC,OAAO,EAAE;AAAlD,CAAhB,CADA,GAEA,sDAFA,GAGA,6CAJF;AAWA,MAAMC,aAAa,GAAG,cAAtB;AAEA,OAAO,MAAMC,YAAY,GACvBP,SAAS,CAACQ,oBAAV,CAA+BF,aAA/B,KAAiD,IAAjD,GACIP,sBAAsB,CAAgBO,aAAhB,CAD1B,GAEI,MAAM;EACJ,MAAM,IAAIG,KAAJ,CAAUP,aAAV,CAAN;AACD,CALA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MFMapView } from './components/MFMapView';
|
|
2
|
+
import { MFMarker } from './components/MFMarker';
|
|
3
|
+
import { MFCircle } from './components/MFCircle';
|
|
4
|
+
import { MFPolyline } from './components/MFPolyline';
|
|
5
|
+
import { MFPolygon } from './components/MFPolygon';
|
|
6
|
+
import { MFPOI } from './components/MFPOI';
|
|
7
|
+
import { MFDirectionsRenderer } from './components/MFDirectionsRenderer';
|
|
8
|
+
import { MFTileOverlay } from './components/MFTileOverlay';
|
|
9
|
+
import { MFBuilding } from './components/MFBuilding';
|
|
10
|
+
export { MFMapView, MFMarker, MFCircle, MFPolyline, MFPolygon, MFPOI, MFDirectionsRenderer, MFTileOverlay, MFBuilding };
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["MFMapView","MFMarker","MFCircle","MFPolyline","MFPolygon","MFPOI","MFDirectionsRenderer","MFTileOverlay","MFBuilding"],"sources":["index.js"],"sourcesContent":["import {MFMapView} from './components/MFMapView'\nimport {MFMarker} from './components/MFMarker'\nimport {MFCircle} from './components/MFCircle'\nimport {MFPolyline} from './components/MFPolyline'\nimport {MFPolygon} from './components/MFPolygon'\nimport {MFPOI} from './components/MFPOI'\nimport {MFDirectionsRenderer} from './components/MFDirectionsRenderer'\nimport {MFTileOverlay} from './components/MFTileOverlay'\nimport {MFBuilding} from './components/MFBuilding'\n\nexport {\n MFMapView,\n MFMarker,\n MFCircle,\n MFPolyline,\n MFPolygon,\n MFPOI,\n MFDirectionsRenderer,\n MFTileOverlay,\n MFBuilding,\n};\n"],"mappings":"AAAA,SAAQA,SAAR,QAAwB,wBAAxB;AACA,SAAQC,QAAR,QAAuB,uBAAvB;AACA,SAAQC,QAAR,QAAuB,uBAAvB;AACA,SAAQC,UAAR,QAAyB,yBAAzB;AACA,SAAQC,SAAR,QAAwB,wBAAxB;AACA,SAAQC,KAAR,QAAoB,oBAApB;AACA,SAAQC,oBAAR,QAAmC,mCAAnC;AACA,SAAQC,aAAR,QAA4B,4BAA5B;AACA,SAAQC,UAAR,QAAyB,yBAAzB;AAEA,SACER,SADF,EAEEC,QAFF,EAGEC,QAHF,EAIEC,UAJF,EAKEC,SALF,EAMEC,KANF,EAOEC,oBAPF,EAQEC,aARF,EASEC,UATF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "react-native-map4d-map-dtqg",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Map4dMap SDK for React Native",
|
|
5
|
+
"main": "lib/commonjs/index",
|
|
6
|
+
"module": "lib/module/index",
|
|
7
|
+
"types": "lib/typescript/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"android",
|
|
14
|
+
"ios",
|
|
15
|
+
"cpp",
|
|
16
|
+
"react-native-map4d-map.podspec",
|
|
17
|
+
"!lib/typescript/example",
|
|
18
|
+
"!android/build",
|
|
19
|
+
"!ios/build",
|
|
20
|
+
"!**/__tests__",
|
|
21
|
+
"!**/__fixtures__",
|
|
22
|
+
"!**/__mocks__"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "jest",
|
|
26
|
+
"typescript": "tsc --noEmit",
|
|
27
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\"",
|
|
28
|
+
"prepare": "bob build",
|
|
29
|
+
"release": "release-it",
|
|
30
|
+
"example": "yarn --cwd example",
|
|
31
|
+
"pods": "cd example && pod-install --quiet",
|
|
32
|
+
"bootstrap": "yarn example && yarn && yarn pods"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"react",
|
|
36
|
+
"react-native",
|
|
37
|
+
"react-component",
|
|
38
|
+
"map",
|
|
39
|
+
"mapview",
|
|
40
|
+
"map4d",
|
|
41
|
+
"iotlink"
|
|
42
|
+
],
|
|
43
|
+
"repository": "https://github.com/map4d/map4d-map-react-native",
|
|
44
|
+
"author": "IOTLink <admin@iotlink.com.vn> (https://iotlink.com.vn/)",
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"bugs": {
|
|
47
|
+
"url": "https://github.com/map4d/map4d-map-react-native/issues"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/map4d/map4d-map-react-native#readme",
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"registry": "https://registry.npmjs.org/"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@commitlint/config-conventional": "^11.0.0",
|
|
55
|
+
"@react-native-community/eslint-config": "^2.0.0",
|
|
56
|
+
"@release-it/conventional-changelog": "^2.0.0",
|
|
57
|
+
"@types/jest": "^26.0.0",
|
|
58
|
+
"@types/react": "^16.9.19",
|
|
59
|
+
"@types/react-native": "0.62.13",
|
|
60
|
+
"commitlint": "^11.0.0",
|
|
61
|
+
"deprecated-react-native-prop-types": "^2.3.0",
|
|
62
|
+
"eslint": "^7.2.0",
|
|
63
|
+
"eslint-config-prettier": "^7.0.0",
|
|
64
|
+
"eslint-plugin-prettier": "^3.1.3",
|
|
65
|
+
"husky": "^6.0.0",
|
|
66
|
+
"jest": "^26.0.1",
|
|
67
|
+
"pod-install": "^0.1.0",
|
|
68
|
+
"prettier": "^2.0.5",
|
|
69
|
+
"react": "16.13.1",
|
|
70
|
+
"react-native": "0.63.4",
|
|
71
|
+
"react-native-builder-bob": "^0.18.2",
|
|
72
|
+
"release-it": "^14.2.2",
|
|
73
|
+
"typescript": "^4.1.3"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"react": "*",
|
|
77
|
+
"react-native": "*"
|
|
78
|
+
},
|
|
79
|
+
"jest": {
|
|
80
|
+
"preset": "react-native",
|
|
81
|
+
"modulePathIgnorePatterns": [
|
|
82
|
+
"<rootDir>/example/node_modules",
|
|
83
|
+
"<rootDir>/lib/"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"commitlint": {
|
|
87
|
+
"extends": [
|
|
88
|
+
"@commitlint/config-conventional"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
"release-it": {
|
|
92
|
+
"git": {
|
|
93
|
+
"commitMessage": "chore: release ${version}",
|
|
94
|
+
"tagName": "v${version}"
|
|
95
|
+
},
|
|
96
|
+
"npm": {
|
|
97
|
+
"publish": true
|
|
98
|
+
},
|
|
99
|
+
"github": {
|
|
100
|
+
"release": true
|
|
101
|
+
},
|
|
102
|
+
"plugins": {
|
|
103
|
+
"@release-it/conventional-changelog": {
|
|
104
|
+
"preset": "angular"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
"eslintConfig": {
|
|
109
|
+
"root": true,
|
|
110
|
+
"extends": [
|
|
111
|
+
"@react-native-community",
|
|
112
|
+
"prettier"
|
|
113
|
+
],
|
|
114
|
+
"rules": {
|
|
115
|
+
"prettier/prettier": [
|
|
116
|
+
"error",
|
|
117
|
+
{
|
|
118
|
+
"quoteProps": "consistent",
|
|
119
|
+
"singleQuote": true,
|
|
120
|
+
"tabWidth": 2,
|
|
121
|
+
"trailingComma": "es5",
|
|
122
|
+
"useTabs": false
|
|
123
|
+
}
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
"eslintIgnore": [
|
|
128
|
+
"node_modules/",
|
|
129
|
+
"lib/"
|
|
130
|
+
],
|
|
131
|
+
"prettier": {
|
|
132
|
+
"quoteProps": "consistent",
|
|
133
|
+
"singleQuote": true,
|
|
134
|
+
"tabWidth": 2,
|
|
135
|
+
"trailingComma": "es5",
|
|
136
|
+
"useTabs": false
|
|
137
|
+
},
|
|
138
|
+
"react-native-builder-bob": {
|
|
139
|
+
"source": "src",
|
|
140
|
+
"output": "lib",
|
|
141
|
+
"targets": [
|
|
142
|
+
"commonjs",
|
|
143
|
+
"module",
|
|
144
|
+
[
|
|
145
|
+
"typescript",
|
|
146
|
+
{
|
|
147
|
+
"project": "tsconfig.build.json"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
]
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "react-native-map4d-map"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => "13.0" }
|
|
14
|
+
s.source = { :git => "https://github.com/map4d/map4d-map-react-native.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
|
+
|
|
18
|
+
s.dependency "React-Core"
|
|
19
|
+
s.dependency "Map4dMapDTQG", "~> 0.1"
|
|
20
|
+
end
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
|
|
4
|
+
import {
|
|
5
|
+
requireNativeComponent,
|
|
6
|
+
Platform,
|
|
7
|
+
NativeModules,
|
|
8
|
+
findNodeHandle
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
|
|
11
|
+
// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
|
|
12
|
+
const viewPropTypes = ViewPropTypes || View.propTypes;
|
|
13
|
+
|
|
14
|
+
const propTypes = {
|
|
15
|
+
...viewPropTypes,
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The name of the building.
|
|
19
|
+
*/
|
|
20
|
+
name: PropTypes.string,
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The position of the building
|
|
24
|
+
*/
|
|
25
|
+
coordinate: PropTypes.shape({
|
|
26
|
+
/**
|
|
27
|
+
* Position for the building.
|
|
28
|
+
*/
|
|
29
|
+
latitude: PropTypes.number.isRequired,
|
|
30
|
+
longitude: PropTypes.number.isRequired,
|
|
31
|
+
}),
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The model URL for the building.
|
|
35
|
+
*/
|
|
36
|
+
modelUrl: PropTypes.string,
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The texture URL for the building.
|
|
40
|
+
*/
|
|
41
|
+
textureUrl: PropTypes.string,
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The scale of the building.
|
|
45
|
+
*/
|
|
46
|
+
scale: PropTypes.number,
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The bearing of the building.
|
|
50
|
+
*/
|
|
51
|
+
bearing: PropTypes.number,
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The elevation of the building.
|
|
55
|
+
*/
|
|
56
|
+
elevation: PropTypes.number,
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Is the building selectable by the user ?
|
|
60
|
+
*/
|
|
61
|
+
selected: PropTypes.bool,
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* touchable
|
|
65
|
+
*/
|
|
66
|
+
touchable: PropTypes.bool,
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* visible
|
|
70
|
+
*/
|
|
71
|
+
visible: PropTypes.bool,
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* userData
|
|
75
|
+
*/
|
|
76
|
+
userData:PropTypes.object,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Callback that is called when the user presses on the building
|
|
80
|
+
*/
|
|
81
|
+
onPress: PropTypes.func,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class MFBuilding extends React.Component {
|
|
86
|
+
constructor(props) {
|
|
87
|
+
super(props);
|
|
88
|
+
this._onPress = this._onPress.bind(this)
|
|
89
|
+
this._ref = this._ref.bind(this)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
_onPress(event) {
|
|
93
|
+
event.stopPropagation();
|
|
94
|
+
if (this.props.onPress) {
|
|
95
|
+
this.props.onPress(event);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
_ref(ref) {
|
|
100
|
+
this.building = ref;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
setName(name) {
|
|
104
|
+
this._runCommand("setName", [name])
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
setScale(scale) {
|
|
108
|
+
this._runCommand("setScale", [scale])
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
setBearing(bearing) {
|
|
112
|
+
this._runCommand("setBearing", [bearing])
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
setElevation(elevation) {
|
|
116
|
+
this._runCommand("setElevation", [elevation])
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
setSelected(selected) {
|
|
120
|
+
this._runCommand("setSelected", [selected])
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
setTouchable(touchable) {
|
|
124
|
+
this._runCommand("setTouchable", [touchable])
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
setVisible(visible) {
|
|
128
|
+
this._runCommand("setVisible", [visible])
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
setUserData(userData) {
|
|
132
|
+
this._runCommand("setUserData", [userData])
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
_getHandle() {
|
|
136
|
+
return findNodeHandle(this.building);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
_runCommand(name, args) {
|
|
140
|
+
switch (Platform.OS) {
|
|
141
|
+
case 'android':
|
|
142
|
+
NativeModules.UIManager.dispatchViewManagerCommand(
|
|
143
|
+
this._getHandle(),
|
|
144
|
+
this._uiManagerCommand(name),
|
|
145
|
+
args
|
|
146
|
+
);
|
|
147
|
+
break;
|
|
148
|
+
|
|
149
|
+
case 'ios':
|
|
150
|
+
this._mapManagerCommand(name)(this._getHandle(), ...args);
|
|
151
|
+
break;
|
|
152
|
+
|
|
153
|
+
default:
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
_uiManagerCommand(name) {
|
|
159
|
+
const UIManager = NativeModules.UIManager;
|
|
160
|
+
const componentName = "RMFBuilding";
|
|
161
|
+
|
|
162
|
+
if (!UIManager.getViewManagerConfig) {
|
|
163
|
+
// RN < 0.58
|
|
164
|
+
return UIManager[componentName].Commands[name];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// RN >= 0.58
|
|
168
|
+
return UIManager.getViewManagerConfig(componentName).Commands[name];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
_mapManagerCommand(name) {
|
|
172
|
+
return NativeModules[`RMFBuilding`][name];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
render() {
|
|
176
|
+
return <RMFBuilding
|
|
177
|
+
{...this.props}
|
|
178
|
+
ref={this._ref}
|
|
179
|
+
onPress={this._onPress}
|
|
180
|
+
/>;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
MFBuilding.propTypes = propTypes;
|
|
185
|
+
|
|
186
|
+
var RMFBuilding = requireNativeComponent(`RMFBuilding`, MFBuilding);
|
|
187
|
+
|
|
188
|
+
export { MFBuilding }
|