react-native-maps 1.21.0-alpha.79 → 1.21.0-alpha.80
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/android/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +58 -0
- package/android/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +27 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +1 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +1 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +22 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +15 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +83 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +1 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +11 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.h +12 -0
- package/android/src/main/java/com/rnmaps/fabric/PolylineManager.java +121 -0
- package/android/src/main/java/com/rnmaps/fabric/event/OnPanDragEvent.java +28 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +5 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +207 -141
- package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -16
- package/android/src/main/java/com/rnmaps/maps/MapView.java +2 -3
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +1 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +1 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +22 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +22 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +15 -0
- package/ios/generated/RNMapsSpecs/Props.h +83 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +4 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +1 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +11 -0
- package/ios/generated/RNMapsSpecs/States.h +12 -0
- package/lib/MapCallout.js +0 -1
- package/lib/MapPolyline.d.ts +5 -5
- package/lib/decorateMapComponent.js +10 -3
- package/lib/specs/NativeComponentPolyline.d.ts +101 -0
- package/lib/specs/NativeComponentPolyline.js +7 -0
- package/package.json +1 -1
package/android/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ColorPropConverter;
|
|
15
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
16
|
+
import com.facebook.react.uimanager.BaseViewManager;
|
|
17
|
+
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
|
18
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
19
|
+
|
|
20
|
+
public class RNMapsPolylineManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNMapsPolylineManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
|
21
|
+
public RNMapsPolylineManagerDelegate(U viewManager) {
|
|
22
|
+
super(viewManager);
|
|
23
|
+
}
|
|
24
|
+
@Override
|
|
25
|
+
public void setProperty(T view, String propName, @Nullable Object value) {
|
|
26
|
+
switch (propName) {
|
|
27
|
+
case "coordinates":
|
|
28
|
+
mViewManager.setCoordinates(view, (ReadableArray) value);
|
|
29
|
+
break;
|
|
30
|
+
case "geodesic":
|
|
31
|
+
mViewManager.setGeodesic(view, value == null ? false : (boolean) value);
|
|
32
|
+
break;
|
|
33
|
+
case "lineCap":
|
|
34
|
+
mViewManager.setLineCap(view, (String) value);
|
|
35
|
+
break;
|
|
36
|
+
case "lineDashPattern":
|
|
37
|
+
mViewManager.setLineDashPattern(view, (ReadableArray) value);
|
|
38
|
+
break;
|
|
39
|
+
case "lineJoin":
|
|
40
|
+
mViewManager.setLineJoin(view, (String) value);
|
|
41
|
+
break;
|
|
42
|
+
case "strokeColor":
|
|
43
|
+
mViewManager.setStrokeColor(view, ColorPropConverter.getColor(value, view.getContext()));
|
|
44
|
+
break;
|
|
45
|
+
case "strokeColors":
|
|
46
|
+
mViewManager.setStrokeColors(view, (ReadableArray) value);
|
|
47
|
+
break;
|
|
48
|
+
case "strokeWidth":
|
|
49
|
+
mViewManager.setStrokeWidth(view, value == null ? 0f : ((Double) value).floatValue());
|
|
50
|
+
break;
|
|
51
|
+
case "tappable":
|
|
52
|
+
mViewManager.setTappable(view, value == null ? false : (boolean) value);
|
|
53
|
+
break;
|
|
54
|
+
default:
|
|
55
|
+
super.setProperty(view, propName, value);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/android/generated/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GeneratePropsJavaInterface.js
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
package com.facebook.react.viewmanagers;
|
|
11
|
+
|
|
12
|
+
import android.view.View;
|
|
13
|
+
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
15
|
+
import com.facebook.react.uimanager.ViewManagerWithGeneratedInterface;
|
|
16
|
+
|
|
17
|
+
public interface RNMapsPolylineManagerInterface<T extends View> extends ViewManagerWithGeneratedInterface {
|
|
18
|
+
void setCoordinates(T view, @Nullable ReadableArray value);
|
|
19
|
+
void setGeodesic(T view, boolean value);
|
|
20
|
+
void setLineCap(T view, @Nullable String value);
|
|
21
|
+
void setLineDashPattern(T view, @Nullable ReadableArray value);
|
|
22
|
+
void setLineJoin(T view, @Nullable String value);
|
|
23
|
+
void setStrokeColor(T view, @Nullable Integer value);
|
|
24
|
+
void setStrokeColors(T view, @Nullable ReadableArray value);
|
|
25
|
+
void setStrokeWidth(T view, float value);
|
|
26
|
+
void setTappable(T view, boolean value);
|
|
27
|
+
}
|
package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp
CHANGED
|
@@ -21,6 +21,7 @@ registry->add(concreteComponentDescriptorProvider<RNMapsGoogleMapViewComponentDe
|
|
|
21
21
|
registry->add(concreteComponentDescriptorProvider<RNMapsGooglePolygonComponentDescriptor>());
|
|
22
22
|
registry->add(concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>());
|
|
23
23
|
registry->add(concreteComponentDescriptorProvider<RNMapsMarkerComponentDescriptor>());
|
|
24
|
+
registry->add(concreteComponentDescriptorProvider<RNMapsPolylineComponentDescriptor>());
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
} // namespace facebook::react
|
|
@@ -21,6 +21,7 @@ using RNMapsGoogleMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMap
|
|
|
21
21
|
using RNMapsGooglePolygonComponentDescriptor = ConcreteComponentDescriptor<RNMapsGooglePolygonShadowNode>;
|
|
22
22
|
using RNMapsMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsMapViewShadowNode>;
|
|
23
23
|
using RNMapsMarkerComponentDescriptor = ConcreteComponentDescriptor<RNMapsMarkerShadowNode>;
|
|
24
|
+
using RNMapsPolylineComponentDescriptor = ConcreteComponentDescriptor<RNMapsPolylineShadowNode>;
|
|
24
25
|
|
|
25
26
|
void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
|
|
26
27
|
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
|
|
@@ -915,4 +915,26 @@ $payload.setProperty(runtime, "id", $event.id);
|
|
|
915
915
|
});
|
|
916
916
|
}
|
|
917
917
|
|
|
918
|
+
|
|
919
|
+
void RNMapsPolylineEventEmitter::onPress(OnPress $event) const {
|
|
920
|
+
dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
921
|
+
auto $payload = jsi::Object(runtime);
|
|
922
|
+
$payload.setProperty(runtime, "action", $event.action);
|
|
923
|
+
$payload.setProperty(runtime, "id", $event.id);
|
|
924
|
+
{
|
|
925
|
+
auto coordinate = jsi::Object(runtime);
|
|
926
|
+
coordinate.setProperty(runtime, "latitude", $event.coordinate.latitude);
|
|
927
|
+
coordinate.setProperty(runtime, "longitude", $event.coordinate.longitude);
|
|
928
|
+
$payload.setProperty(runtime, "coordinate", coordinate);
|
|
929
|
+
}
|
|
930
|
+
{
|
|
931
|
+
auto position = jsi::Object(runtime);
|
|
932
|
+
position.setProperty(runtime, "x", $event.position.x);
|
|
933
|
+
position.setProperty(runtime, "y", $event.position.y);
|
|
934
|
+
$payload.setProperty(runtime, "position", position);
|
|
935
|
+
}
|
|
936
|
+
return $payload;
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
|
|
918
940
|
} // namespace facebook::react
|
|
@@ -784,4 +784,26 @@ class RNMapsMarkerEventEmitter : public ViewEventEmitter {
|
|
|
784
784
|
|
|
785
785
|
void onSelect(OnSelect value) const;
|
|
786
786
|
};
|
|
787
|
+
class RNMapsPolylineEventEmitter : public ViewEventEmitter {
|
|
788
|
+
public:
|
|
789
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
790
|
+
|
|
791
|
+
struct OnPressCoordinate {
|
|
792
|
+
double latitude;
|
|
793
|
+
double longitude;
|
|
794
|
+
};
|
|
795
|
+
|
|
796
|
+
struct OnPressPosition {
|
|
797
|
+
double x;
|
|
798
|
+
double y;
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
struct OnPress {
|
|
802
|
+
std::string action;
|
|
803
|
+
std::string id;
|
|
804
|
+
OnPressCoordinate coordinate;
|
|
805
|
+
OnPressPosition position;
|
|
806
|
+
};
|
|
807
|
+
void onPress(OnPress value) const;
|
|
808
|
+
};
|
|
787
809
|
} // namespace facebook::react
|
|
@@ -151,5 +151,20 @@ RNMapsMarkerProps::RNMapsMarkerProps(
|
|
|
151
151
|
subtitleVisibility(convertRawProp(context, rawProps, "subtitleVisibility", sourceProps.subtitleVisibility, {RNMapsMarkerSubtitleVisibility::Adaptive})),
|
|
152
152
|
useLegacyPinView(convertRawProp(context, rawProps, "useLegacyPinView", sourceProps.useLegacyPinView, {false}))
|
|
153
153
|
{}
|
|
154
|
+
RNMapsPolylineProps::RNMapsPolylineProps(
|
|
155
|
+
const PropsParserContext &context,
|
|
156
|
+
const RNMapsPolylineProps &sourceProps,
|
|
157
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
158
|
+
|
|
159
|
+
coordinates(convertRawProp(context, rawProps, "coordinates", sourceProps.coordinates, {})),
|
|
160
|
+
geodesic(convertRawProp(context, rawProps, "geodesic", sourceProps.geodesic, {false})),
|
|
161
|
+
lineCap(convertRawProp(context, rawProps, "lineCap", sourceProps.lineCap, {RNMapsPolylineLineCap::Butt})),
|
|
162
|
+
lineDashPattern(convertRawProp(context, rawProps, "lineDashPattern", sourceProps.lineDashPattern, {})),
|
|
163
|
+
lineJoin(convertRawProp(context, rawProps, "lineJoin", sourceProps.lineJoin, {RNMapsPolylineLineJoin::Miter})),
|
|
164
|
+
strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, {})),
|
|
165
|
+
strokeColors(convertRawProp(context, rawProps, "strokeColors", sourceProps.strokeColors, {})),
|
|
166
|
+
strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {0.0})),
|
|
167
|
+
tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
|
|
168
|
+
{}
|
|
154
169
|
|
|
155
170
|
} // namespace facebook::react
|
|
@@ -1056,4 +1056,87 @@ class RNMapsMarkerProps final : public ViewProps {
|
|
|
1056
1056
|
bool useLegacyPinView{false};
|
|
1057
1057
|
};
|
|
1058
1058
|
|
|
1059
|
+
enum class RNMapsPolylineLineCap { Butt, Round, Square };
|
|
1060
|
+
|
|
1061
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsPolylineLineCap &result) {
|
|
1062
|
+
auto string = (std::string)value;
|
|
1063
|
+
if (string == "butt") { result = RNMapsPolylineLineCap::Butt; return; }
|
|
1064
|
+
if (string == "round") { result = RNMapsPolylineLineCap::Round; return; }
|
|
1065
|
+
if (string == "square") { result = RNMapsPolylineLineCap::Square; return; }
|
|
1066
|
+
abort();
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
static inline std::string toString(const RNMapsPolylineLineCap &value) {
|
|
1070
|
+
switch (value) {
|
|
1071
|
+
case RNMapsPolylineLineCap::Butt: return "butt";
|
|
1072
|
+
case RNMapsPolylineLineCap::Round: return "round";
|
|
1073
|
+
case RNMapsPolylineLineCap::Square: return "square";
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
enum class RNMapsPolylineLineJoin { Miter, Round, Bevel };
|
|
1077
|
+
|
|
1078
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsPolylineLineJoin &result) {
|
|
1079
|
+
auto string = (std::string)value;
|
|
1080
|
+
if (string == "miter") { result = RNMapsPolylineLineJoin::Miter; return; }
|
|
1081
|
+
if (string == "round") { result = RNMapsPolylineLineJoin::Round; return; }
|
|
1082
|
+
if (string == "bevel") { result = RNMapsPolylineLineJoin::Bevel; return; }
|
|
1083
|
+
abort();
|
|
1084
|
+
}
|
|
1085
|
+
|
|
1086
|
+
static inline std::string toString(const RNMapsPolylineLineJoin &value) {
|
|
1087
|
+
switch (value) {
|
|
1088
|
+
case RNMapsPolylineLineJoin::Miter: return "miter";
|
|
1089
|
+
case RNMapsPolylineLineJoin::Round: return "round";
|
|
1090
|
+
case RNMapsPolylineLineJoin::Bevel: return "bevel";
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
struct RNMapsPolylineCoordinatesStruct {
|
|
1094
|
+
double latitude{0.0};
|
|
1095
|
+
double longitude{0.0};
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsPolylineCoordinatesStruct &result) {
|
|
1099
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
1100
|
+
|
|
1101
|
+
auto tmp_latitude = map.find("latitude");
|
|
1102
|
+
if (tmp_latitude != map.end()) {
|
|
1103
|
+
fromRawValue(context, tmp_latitude->second, result.latitude);
|
|
1104
|
+
}
|
|
1105
|
+
auto tmp_longitude = map.find("longitude");
|
|
1106
|
+
if (tmp_longitude != map.end()) {
|
|
1107
|
+
fromRawValue(context, tmp_longitude->second, result.longitude);
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
static inline std::string toString(const RNMapsPolylineCoordinatesStruct &value) {
|
|
1112
|
+
return "[Object RNMapsPolylineCoordinatesStruct]";
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<RNMapsPolylineCoordinatesStruct> &result) {
|
|
1116
|
+
auto items = (std::vector<RawValue>)value;
|
|
1117
|
+
for (const auto &item : items) {
|
|
1118
|
+
RNMapsPolylineCoordinatesStruct newItem;
|
|
1119
|
+
fromRawValue(context, item, newItem);
|
|
1120
|
+
result.emplace_back(newItem);
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
class RNMapsPolylineProps final : public ViewProps {
|
|
1125
|
+
public:
|
|
1126
|
+
RNMapsPolylineProps() = default;
|
|
1127
|
+
RNMapsPolylineProps(const PropsParserContext& context, const RNMapsPolylineProps &sourceProps, const RawProps &rawProps);
|
|
1128
|
+
|
|
1129
|
+
#pragma mark - Props
|
|
1130
|
+
|
|
1131
|
+
std::vector<RNMapsPolylineCoordinatesStruct> coordinates{};
|
|
1132
|
+
bool geodesic{false};
|
|
1133
|
+
RNMapsPolylineLineCap lineCap{RNMapsPolylineLineCap::Butt};
|
|
1134
|
+
std::vector<double> lineDashPattern{};
|
|
1135
|
+
RNMapsPolylineLineJoin lineJoin{RNMapsPolylineLineJoin::Miter};
|
|
1136
|
+
SharedColor strokeColor{};
|
|
1137
|
+
std::vector<SharedColor> strokeColors{};
|
|
1138
|
+
Float strokeWidth{0.0};
|
|
1139
|
+
bool tappable{false};
|
|
1140
|
+
};
|
|
1141
|
+
|
|
1059
1142
|
} // namespace facebook::react
|
|
@@ -17,5 +17,6 @@ extern const char RNMapsGoogleMapViewComponentName[] = "RNMapsGoogleMapView";
|
|
|
17
17
|
extern const char RNMapsGooglePolygonComponentName[] = "RNMapsGooglePolygon";
|
|
18
18
|
extern const char RNMapsMapViewComponentName[] = "RNMapsMapView";
|
|
19
19
|
extern const char RNMapsMarkerComponentName[] = "RNMapsMarker";
|
|
20
|
+
extern const char RNMapsPolylineComponentName[] = "RNMapsPolyline";
|
|
20
21
|
|
|
21
22
|
} // namespace facebook::react
|
|
@@ -73,4 +73,15 @@ using RNMapsMarkerShadowNode = ConcreteViewShadowNode<
|
|
|
73
73
|
RNMapsMarkerEventEmitter,
|
|
74
74
|
RNMapsMarkerState>;
|
|
75
75
|
|
|
76
|
+
JSI_EXPORT extern const char RNMapsPolylineComponentName[];
|
|
77
|
+
|
|
78
|
+
/*
|
|
79
|
+
* `ShadowNode` for <RNMapsPolyline> component.
|
|
80
|
+
*/
|
|
81
|
+
using RNMapsPolylineShadowNode = ConcreteViewShadowNode<
|
|
82
|
+
RNMapsPolylineComponentName,
|
|
83
|
+
RNMapsPolylineProps,
|
|
84
|
+
RNMapsPolylineEventEmitter,
|
|
85
|
+
RNMapsPolylineState>;
|
|
86
|
+
|
|
76
87
|
} // namespace facebook::react
|
|
@@ -74,4 +74,16 @@ public:
|
|
|
74
74
|
#endif
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
class RNMapsPolylineState {
|
|
78
|
+
public:
|
|
79
|
+
RNMapsPolylineState() = default;
|
|
80
|
+
|
|
81
|
+
#ifdef ANDROID
|
|
82
|
+
RNMapsPolylineState(RNMapsPolylineState const &previousState, folly::dynamic data){};
|
|
83
|
+
folly::dynamic getDynamic() const {
|
|
84
|
+
return {};
|
|
85
|
+
};
|
|
86
|
+
#endif
|
|
87
|
+
};
|
|
88
|
+
|
|
77
89
|
} // namespace facebook::react
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
package com.rnmaps.fabric;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import android.content.Context;
|
|
5
|
+
import android.util.DisplayMetrics;
|
|
6
|
+
import android.view.WindowManager;
|
|
7
|
+
|
|
8
|
+
import androidx.annotation.Nullable;
|
|
9
|
+
|
|
10
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
11
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
12
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
13
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
14
|
+
import com.facebook.react.uimanager.ViewGroupManager;
|
|
15
|
+
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
16
|
+
import com.facebook.react.viewmanagers.RNMapsPolylineManagerDelegate;
|
|
17
|
+
import com.facebook.react.viewmanagers.RNMapsPolylineManagerInterface;
|
|
18
|
+
import com.rnmaps.maps.MapPolyline;
|
|
19
|
+
|
|
20
|
+
import java.util.HashMap;
|
|
21
|
+
import java.util.Map;
|
|
22
|
+
|
|
23
|
+
@ReactModule(name = PolylineManager.REACT_CLASS)
|
|
24
|
+
public class PolylineManager extends ViewGroupManager<MapPolyline> implements RNMapsPolylineManagerInterface<MapPolyline> {
|
|
25
|
+
private DisplayMetrics metrics;
|
|
26
|
+
|
|
27
|
+
public PolylineManager(ReactApplicationContext context) {
|
|
28
|
+
super(context);
|
|
29
|
+
metrics = new DisplayMetrics();
|
|
30
|
+
((WindowManager) context.getSystemService(Context.WINDOW_SERVICE))
|
|
31
|
+
.getDefaultDisplay()
|
|
32
|
+
.getRealMetrics(metrics);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
private final RNMapsPolylineManagerDelegate<MapPolyline, PolylineManager> delegate =
|
|
36
|
+
new RNMapsPolylineManagerDelegate<>(this);
|
|
37
|
+
|
|
38
|
+
@Override
|
|
39
|
+
public ViewManagerDelegate<MapPolyline> getDelegate() {
|
|
40
|
+
return delegate;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
public String getName() {
|
|
45
|
+
return REACT_CLASS;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@Override
|
|
49
|
+
public MapPolyline createViewInstance(ThemedReactContext context) {
|
|
50
|
+
return new MapPolyline(context);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
public static final String REACT_CLASS = "RNMapsPolyline";
|
|
55
|
+
|
|
56
|
+
@Nullable
|
|
57
|
+
@Override
|
|
58
|
+
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
59
|
+
return MapPolyline.getExportedCustomBubblingEventTypeConstants();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@Nullable
|
|
63
|
+
@Override
|
|
64
|
+
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
65
|
+
return new HashMap<>();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@Override
|
|
70
|
+
public void setCoordinates(MapPolyline view, @Nullable ReadableArray value) {
|
|
71
|
+
view.setCoordinates(value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@Override
|
|
76
|
+
public void setStrokeColor(MapPolyline view, @Nullable Integer value) {
|
|
77
|
+
view.setColor(value);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public void setStrokeColors(MapPolyline view, @Nullable ReadableArray value) {
|
|
82
|
+
view.setStrokeColors(value);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@Override
|
|
86
|
+
public void setStrokeWidth(MapPolyline view, float value) {
|
|
87
|
+
float widthInScreenPx = metrics.density * value; // done for parity with iOS
|
|
88
|
+
view.setWidth(widthInScreenPx);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@Override
|
|
92
|
+
public void setGeodesic(MapPolyline view, boolean value) {
|
|
93
|
+
view.setGeodesic(value);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@Override
|
|
97
|
+
public void setLineCap(MapPolyline view, @Nullable String value) {
|
|
98
|
+
view.setLineCap(value);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
@Override
|
|
102
|
+
public void setLineDashPattern(MapPolyline view, @Nullable ReadableArray value) {
|
|
103
|
+
view.setLineDashPattern(value);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@Override
|
|
107
|
+
public void setLineJoin(MapPolyline view, @Nullable String value) {
|
|
108
|
+
view.setLineJoin(value);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@Override
|
|
113
|
+
public void setTappable(MapPolyline view, boolean value) {
|
|
114
|
+
view.setTappable(value);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@Override
|
|
118
|
+
public void setZIndex(MapPolyline view, float value) {
|
|
119
|
+
view.setZIndex(value);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
package com.rnmaps.fabric.event;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.WritableMap;
|
|
6
|
+
import com.facebook.react.uimanager.events.Event;
|
|
7
|
+
|
|
8
|
+
public class OnPanDragEvent extends Event<OnPanDragEvent> {
|
|
9
|
+
public static final String EVENT_NAME = "topPanDrag";
|
|
10
|
+
|
|
11
|
+
private final WritableMap payload;
|
|
12
|
+
|
|
13
|
+
public OnPanDragEvent(int surfaceId, int viewId, WritableMap payload) {
|
|
14
|
+
super(surfaceId, viewId);
|
|
15
|
+
this.payload = payload;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@NonNull
|
|
19
|
+
@Override
|
|
20
|
+
public String getEventName() {
|
|
21
|
+
return EVENT_NAME;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@Override
|
|
25
|
+
public WritableMap getEventData() {
|
|
26
|
+
return payload;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -14,6 +14,7 @@ import com.rnmaps.fabric.MarkerManager;
|
|
|
14
14
|
import com.rnmaps.fabric.NativeAirMapsModule;
|
|
15
15
|
import com.facebook.fbreact.specs.NativeAirMapsModuleSpec;
|
|
16
16
|
import com.rnmaps.fabric.PolygonManager;
|
|
17
|
+
import com.rnmaps.fabric.PolylineManager;
|
|
17
18
|
|
|
18
19
|
import java.util.HashMap;
|
|
19
20
|
import java.util.List;
|
|
@@ -23,12 +24,15 @@ public class MapAirModulePackage extends TurboReactPackage {
|
|
|
23
24
|
|
|
24
25
|
@Override
|
|
25
26
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
26
|
-
return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext), new CalloutManager(reactContext), new PolygonManager(reactContext));
|
|
27
|
+
return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext), new CalloutManager(reactContext), new PolygonManager(reactContext), new PolylineManager(reactContext));
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
@Override
|
|
31
32
|
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
33
|
+
if (PolylineManager.REACT_CLASS.equals(name)) {
|
|
34
|
+
return new PolylineManager(reactContext);
|
|
35
|
+
}
|
|
32
36
|
if (PolygonManager.REACT_CLASS.equals(name)) {
|
|
33
37
|
return new PolygonManager(reactContext);
|
|
34
38
|
}
|