react-native-maps 1.21.0-alpha.64 → 1.21.0-alpha.66
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/build.gradle +2 -1
- 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 +8 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +11 -0
- package/android/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +6 -2
- 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/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/rnmaps/fabric/CalloutManager.java +89 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +0 -3
- package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +16 -1
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +5 -1
- package/android/src/main/java/com/rnmaps/maps/MapCallout.java +19 -0
- 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 +8 -0
- package/ios/generated/RNMapsSpecs/Props.h +11 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +3 -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/ios/generated/RNMapsSpecsJSI.h +6 -2
- package/lib/MapCallout.js +1 -0
- package/lib/decorateMapComponent.js +5 -0
- package/lib/specs/NativeComponentCallout.d.ts +46 -0
- package/lib/specs/NativeComponentCallout.js +9 -0
- package/package.json +1 -1
package/android/build.gradle
CHANGED
|
@@ -12,7 +12,8 @@ buildscript {
|
|
|
12
12
|
mavenCentral()
|
|
13
13
|
}
|
|
14
14
|
dependencies {
|
|
15
|
-
classpath("com.android.tools.build:gradle:8.
|
|
15
|
+
classpath("com.android.tools.build:gradle:8.7.2")
|
|
16
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '2.0.21')}")
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
}
|
package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp
CHANGED
|
@@ -16,6 +16,7 @@ namespace facebook::react {
|
|
|
16
16
|
|
|
17
17
|
void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
|
|
18
18
|
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<RNMapsCalloutComponentDescriptor>());
|
|
19
20
|
registry->add(concreteComponentDescriptorProvider<RNMapsGoogleMapViewComponentDescriptor>());
|
|
20
21
|
registry->add(concreteComponentDescriptorProvider<RNMapsGooglePolygonComponentDescriptor>());
|
|
21
22
|
registry->add(concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>());
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
namespace facebook::react {
|
|
18
18
|
|
|
19
|
+
using RNMapsCalloutComponentDescriptor = ConcreteComponentDescriptor<RNMapsCalloutShadowNode>;
|
|
19
20
|
using RNMapsGoogleMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsGoogleMapViewShadowNode>;
|
|
20
21
|
using RNMapsGooglePolygonComponentDescriptor = ConcreteComponentDescriptor<RNMapsGooglePolygonShadowNode>;
|
|
21
22
|
using RNMapsMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsMapViewShadowNode>;
|
|
@@ -13,6 +13,28 @@
|
|
|
13
13
|
|
|
14
14
|
namespace facebook::react {
|
|
15
15
|
|
|
16
|
+
void RNMapsCalloutEventEmitter::onPress(OnPress $event) const {
|
|
17
|
+
dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
|
+
auto $payload = jsi::Object(runtime);
|
|
19
|
+
$payload.setProperty(runtime, "action", $event.action);
|
|
20
|
+
$payload.setProperty(runtime, "id", $event.id);
|
|
21
|
+
{
|
|
22
|
+
auto coordinate = jsi::Object(runtime);
|
|
23
|
+
coordinate.setProperty(runtime, "latitude", $event.coordinate.latitude);
|
|
24
|
+
coordinate.setProperty(runtime, "longitude", $event.coordinate.longitude);
|
|
25
|
+
$payload.setProperty(runtime, "coordinate", coordinate);
|
|
26
|
+
}
|
|
27
|
+
{
|
|
28
|
+
auto position = jsi::Object(runtime);
|
|
29
|
+
position.setProperty(runtime, "x", $event.position.x);
|
|
30
|
+
position.setProperty(runtime, "y", $event.position.y);
|
|
31
|
+
$payload.setProperty(runtime, "position", position);
|
|
32
|
+
}
|
|
33
|
+
return $payload;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
16
38
|
void RNMapsGoogleMapViewEventEmitter::onIndoorBuildingFocused(OnIndoorBuildingFocused $event) const {
|
|
17
39
|
dispatchEvent("indoorBuildingFocused", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
40
|
auto $payload = jsi::Object(runtime);
|
|
@@ -13,6 +13,28 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
namespace facebook::react {
|
|
16
|
+
class RNMapsCalloutEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnPressCoordinate {
|
|
21
|
+
double latitude;
|
|
22
|
+
double longitude;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
struct OnPressPosition {
|
|
26
|
+
double x;
|
|
27
|
+
double y;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
struct OnPress {
|
|
31
|
+
std::string action;
|
|
32
|
+
std::string id;
|
|
33
|
+
OnPressCoordinate coordinate;
|
|
34
|
+
OnPressPosition position;
|
|
35
|
+
};
|
|
36
|
+
void onPress(OnPress value) const;
|
|
37
|
+
};
|
|
16
38
|
class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
|
|
17
39
|
public:
|
|
18
40
|
using ViewEventEmitter::ViewEventEmitter;
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
namespace facebook::react {
|
|
17
17
|
|
|
18
|
+
RNMapsCalloutProps::RNMapsCalloutProps(
|
|
19
|
+
const PropsParserContext &context,
|
|
20
|
+
const RNMapsCalloutProps &sourceProps,
|
|
21
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
22
|
+
|
|
23
|
+
alphaHitTest(convertRawProp(context, rawProps, "alphaHitTest", sourceProps.alphaHitTest, {false})),
|
|
24
|
+
tooltip(convertRawProp(context, rawProps, "tooltip", sourceProps.tooltip, {false}))
|
|
25
|
+
{}
|
|
18
26
|
RNMapsGoogleMapViewProps::RNMapsGoogleMapViewProps(
|
|
19
27
|
const PropsParserContext &context,
|
|
20
28
|
const RNMapsGoogleMapViewProps &sourceProps,
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
|
|
19
19
|
namespace facebook::react {
|
|
20
20
|
|
|
21
|
+
class RNMapsCalloutProps final : public ViewProps {
|
|
22
|
+
public:
|
|
23
|
+
RNMapsCalloutProps() = default;
|
|
24
|
+
RNMapsCalloutProps(const PropsParserContext& context, const RNMapsCalloutProps &sourceProps, const RawProps &rawProps);
|
|
25
|
+
|
|
26
|
+
#pragma mark - Props
|
|
27
|
+
|
|
28
|
+
bool alphaHitTest{false};
|
|
29
|
+
bool tooltip{false};
|
|
30
|
+
};
|
|
31
|
+
|
|
21
32
|
enum class RNMapsGoogleMapViewMapType { Hybrid, MutedStandard, None, Satellite, Standard, Terrain, SatelliteFlyover, HybridFlyover };
|
|
22
33
|
|
|
23
34
|
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsGoogleMapViewMapType &result) {
|
|
@@ -176,8 +176,12 @@ public:
|
|
|
176
176
|
template <typename T>
|
|
177
177
|
class JSI_EXPORT NativeAirMapsModuleCxxSpec : public TurboModule {
|
|
178
178
|
public:
|
|
179
|
-
jsi::Value
|
|
180
|
-
return delegate_.
|
|
179
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
180
|
+
return delegate_.create(rt, propName);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
184
|
+
return delegate_.getPropertyNames(runtime);
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
static constexpr std::string_view kModuleName = "RNMapsAirModule";
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
namespace facebook::react {
|
|
14
14
|
|
|
15
|
+
extern const char RNMapsCalloutComponentName[] = "RNMapsCallout";
|
|
15
16
|
extern const char RNMapsGoogleMapViewComponentName[] = "RNMapsGoogleMapView";
|
|
16
17
|
extern const char RNMapsGooglePolygonComponentName[] = "RNMapsGooglePolygon";
|
|
17
18
|
extern const char RNMapsMapViewComponentName[] = "RNMapsMapView";
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
|
|
19
19
|
namespace facebook::react {
|
|
20
20
|
|
|
21
|
+
JSI_EXPORT extern const char RNMapsCalloutComponentName[];
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* `ShadowNode` for <RNMapsCallout> component.
|
|
25
|
+
*/
|
|
26
|
+
using RNMapsCalloutShadowNode = ConcreteViewShadowNode<
|
|
27
|
+
RNMapsCalloutComponentName,
|
|
28
|
+
RNMapsCalloutProps,
|
|
29
|
+
RNMapsCalloutEventEmitter,
|
|
30
|
+
RNMapsCalloutState>;
|
|
31
|
+
|
|
21
32
|
JSI_EXPORT extern const char RNMapsGoogleMapViewComponentName[];
|
|
22
33
|
|
|
23
34
|
/*
|
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
|
|
15
15
|
namespace facebook::react {
|
|
16
16
|
|
|
17
|
+
class RNMapsCalloutState {
|
|
18
|
+
public:
|
|
19
|
+
RNMapsCalloutState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
RNMapsCalloutState(RNMapsCalloutState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
27
|
+
};
|
|
28
|
+
|
|
17
29
|
class RNMapsGoogleMapViewState {
|
|
18
30
|
public:
|
|
19
31
|
RNMapsGoogleMapViewState() = default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
distributionBase=GRADLE_USER_HOME
|
|
2
2
|
distributionPath=wrapper/dists
|
|
3
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.
|
|
3
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
|
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
|
5
5
|
zipStorePath=wrapper/dists
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
package com.rnmaps.fabric;
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
import androidx.annotation.Nullable;
|
|
5
|
+
|
|
6
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
|
+
import com.facebook.react.module.annotations.ReactModule;
|
|
8
|
+
import com.facebook.react.uimanager.LayoutShadowNode;
|
|
9
|
+
import com.facebook.react.uimanager.ThemedReactContext;
|
|
10
|
+
import com.facebook.react.uimanager.ViewGroupManager;
|
|
11
|
+
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
12
|
+
import com.facebook.react.viewmanagers.RNMapsCalloutManagerDelegate;
|
|
13
|
+
import com.facebook.react.viewmanagers.RNMapsCalloutManagerInterface;
|
|
14
|
+
import com.rnmaps.maps.MapCallout;
|
|
15
|
+
import com.rnmaps.maps.SizeReportingShadowNode;
|
|
16
|
+
|
|
17
|
+
import java.util.HashMap;
|
|
18
|
+
import java.util.Map;
|
|
19
|
+
|
|
20
|
+
@ReactModule(name = CalloutManager.REACT_CLASS)
|
|
21
|
+
public class CalloutManager extends ViewGroupManager<MapCallout> implements RNMapsCalloutManagerInterface<MapCallout> {
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
public CalloutManager(ReactApplicationContext context){
|
|
25
|
+
super(context);
|
|
26
|
+
}
|
|
27
|
+
private final RNMapsCalloutManagerDelegate<MapCallout, CalloutManager> delegate =
|
|
28
|
+
new RNMapsCalloutManagerDelegate<>(this);
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public ViewManagerDelegate<MapCallout> getDelegate() {
|
|
32
|
+
return delegate;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Override
|
|
36
|
+
public String getName() {
|
|
37
|
+
return REACT_CLASS;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Override
|
|
41
|
+
public MapCallout createViewInstance(ThemedReactContext context) {
|
|
42
|
+
return new MapCallout(context);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
public static final String REACT_CLASS = "RNMapsCallout";
|
|
47
|
+
|
|
48
|
+
@Nullable
|
|
49
|
+
@Override
|
|
50
|
+
public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
51
|
+
return MapCallout.getExportedCustomBubblingEventTypeConstants();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@Nullable
|
|
55
|
+
@Override
|
|
56
|
+
public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
|
|
57
|
+
return new HashMap<>();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
@Override
|
|
62
|
+
public void setAlphaHitTest(MapCallout view, boolean value) {
|
|
63
|
+
/// do nothing
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@Override
|
|
67
|
+
public void setTooltip(MapCallout view, boolean value) {
|
|
68
|
+
view.setTooltip(value);
|
|
69
|
+
}
|
|
70
|
+
@Override
|
|
71
|
+
public LayoutShadowNode createShadowNodeInstance() {
|
|
72
|
+
// we use a custom shadow node that emits the width/height of the view
|
|
73
|
+
// after layout with the updateExtraData method. Without this, we can't generate
|
|
74
|
+
// a bitmap of the appropriate width/height of the rendered view.
|
|
75
|
+
return new SizeReportingShadowNode();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@Override
|
|
79
|
+
public void updateExtraData(MapCallout view, Object extraData) {
|
|
80
|
+
// This method is called from the shadow node with the width/height of the rendered
|
|
81
|
+
// marker view.
|
|
82
|
+
//noinspection unchecked
|
|
83
|
+
Map<String, Float> data = (Map<String, Float>) extraData;
|
|
84
|
+
float width = data.get("width");
|
|
85
|
+
float height = data.get("height");
|
|
86
|
+
view.width = (int) width;
|
|
87
|
+
view.height = (int) height;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
@@ -3,8 +3,6 @@ package com.rnmaps.fabric;
|
|
|
3
3
|
|
|
4
4
|
import static com.rnmaps.maps.MapManager.MY_LOCATION_PRIORITY;
|
|
5
5
|
|
|
6
|
-
import android.graphics.drawable.Drawable;
|
|
7
|
-
import android.net.Uri;
|
|
8
6
|
import android.util.Log;
|
|
9
7
|
import android.view.View;
|
|
10
8
|
|
|
@@ -28,7 +26,6 @@ import com.facebook.react.uimanager.ViewGroupManager;
|
|
|
28
26
|
import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
29
27
|
import com.facebook.react.viewmanagers.RNMapsMapViewManagerInterface;
|
|
30
28
|
import com.facebook.react.viewmanagers.RNMapsMapViewManagerDelegate;
|
|
31
|
-
import com.google.android.gms.common.images.ImageManager;
|
|
32
29
|
import com.google.android.gms.maps.GoogleMap;
|
|
33
30
|
import com.google.android.gms.maps.GoogleMapOptions;
|
|
34
31
|
import com.google.android.gms.maps.MapsInitializer;
|
|
@@ -2,6 +2,7 @@ package com.rnmaps.fabric;
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
import android.util.Log;
|
|
5
|
+
import android.view.View;
|
|
5
6
|
|
|
6
7
|
import androidx.annotation.NonNull;
|
|
7
8
|
import androidx.annotation.Nullable;
|
|
@@ -17,7 +18,9 @@ import com.facebook.react.uimanager.ViewManagerDelegate;
|
|
|
17
18
|
import com.facebook.react.viewmanagers.RNMapsMarkerManagerDelegate;
|
|
18
19
|
import com.facebook.react.viewmanagers.RNMapsMarkerManagerInterface;
|
|
19
20
|
import com.google.android.gms.maps.model.LatLng;
|
|
21
|
+
import com.google.android.gms.maps.model.Marker;
|
|
20
22
|
import com.google.android.gms.maps.model.MarkerOptions;
|
|
23
|
+
import com.rnmaps.maps.MapCallout;
|
|
21
24
|
import com.rnmaps.maps.MapMarker;
|
|
22
25
|
|
|
23
26
|
import java.util.Map;
|
|
@@ -220,12 +223,13 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
220
223
|
|
|
221
224
|
@Override
|
|
222
225
|
public void showCallout(MapMarker view) {
|
|
226
|
+
((Marker) view.getFeature()).showInfoWindow();
|
|
223
227
|
|
|
224
228
|
}
|
|
225
229
|
|
|
226
230
|
@Override
|
|
227
231
|
public void hideCallout(MapMarker view) {
|
|
228
|
-
|
|
232
|
+
((Marker) view.getFeature()).hideInfoWindow();
|
|
229
233
|
}
|
|
230
234
|
|
|
231
235
|
@Override
|
|
@@ -237,4 +241,15 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
|
|
|
237
241
|
public void redraw(MapMarker view) {
|
|
238
242
|
|
|
239
243
|
}
|
|
244
|
+
@Override
|
|
245
|
+
public void addView(MapMarker parent, View child, int index) {
|
|
246
|
+
// if an <Callout /> component is a child, then it is a callout view, NOT part of the
|
|
247
|
+
// marker.
|
|
248
|
+
if (child instanceof MapCallout) {
|
|
249
|
+
parent.setCalloutView((MapCallout) child);
|
|
250
|
+
} else {
|
|
251
|
+
super.addView(parent, child, index);
|
|
252
|
+
parent.update(true);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
240
255
|
}
|
|
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReactApplicationContext;
|
|
|
8
8
|
import com.facebook.react.module.model.ReactModuleInfo;
|
|
9
9
|
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
10
10
|
import com.facebook.react.uimanager.ViewManager;
|
|
11
|
+
import com.rnmaps.fabric.CalloutManager;
|
|
11
12
|
import com.rnmaps.fabric.MapViewManager;
|
|
12
13
|
import com.rnmaps.fabric.MarkerManager;
|
|
13
14
|
import com.rnmaps.fabric.NativeAirMapsModule;
|
|
@@ -21,12 +22,15 @@ public class MapAirModulePackage extends TurboReactPackage {
|
|
|
21
22
|
|
|
22
23
|
@Override
|
|
23
24
|
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
24
|
-
return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext));
|
|
25
|
+
return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext), new CalloutManager(reactContext));
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
@Override
|
|
29
30
|
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
31
|
+
if (CalloutManager.REACT_CLASS.equals(name)) {
|
|
32
|
+
return new CalloutManager(reactContext);
|
|
33
|
+
}
|
|
30
34
|
if (MarkerManager.REACT_CLASS.equals(name)) {
|
|
31
35
|
return new MarkerManager(reactContext);
|
|
32
36
|
}
|
|
@@ -2,7 +2,19 @@ package com.rnmaps.maps;
|
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
5
|
+
import com.facebook.react.common.MapBuilder;
|
|
5
6
|
import com.facebook.react.views.view.ReactViewGroup;
|
|
7
|
+
import com.rnmaps.fabric.event.OnLongPressEvent;
|
|
8
|
+
import com.rnmaps.fabric.event.OnMarkerDeselectEvent;
|
|
9
|
+
import com.rnmaps.fabric.event.OnMarkerDragEndEvent;
|
|
10
|
+
import com.rnmaps.fabric.event.OnMarkerDragEvent;
|
|
11
|
+
import com.rnmaps.fabric.event.OnMarkerDragStartEvent;
|
|
12
|
+
import com.rnmaps.fabric.event.OnMarkerPressEvent;
|
|
13
|
+
import com.rnmaps.fabric.event.OnMarkerSelectEvent;
|
|
14
|
+
import com.rnmaps.fabric.event.OnPoiClickEvent;
|
|
15
|
+
import com.rnmaps.fabric.event.OnPressEvent;
|
|
16
|
+
|
|
17
|
+
import java.util.Map;
|
|
6
18
|
|
|
7
19
|
public class MapCallout extends ReactViewGroup {
|
|
8
20
|
private boolean tooltip = false;
|
|
@@ -20,4 +32,11 @@ public class MapCallout extends ReactViewGroup {
|
|
|
20
32
|
public boolean getTooltip() {
|
|
21
33
|
return this.tooltip;
|
|
22
34
|
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
|
|
38
|
+
MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
|
|
39
|
+
builder.put(OnPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPressEvent.EVENT_NAME));
|
|
40
|
+
return builder.build();
|
|
41
|
+
}
|
|
23
42
|
}
|
|
@@ -16,6 +16,7 @@ namespace facebook::react {
|
|
|
16
16
|
|
|
17
17
|
void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
|
|
18
18
|
std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
|
|
19
|
+
registry->add(concreteComponentDescriptorProvider<RNMapsCalloutComponentDescriptor>());
|
|
19
20
|
registry->add(concreteComponentDescriptorProvider<RNMapsGoogleMapViewComponentDescriptor>());
|
|
20
21
|
registry->add(concreteComponentDescriptorProvider<RNMapsGooglePolygonComponentDescriptor>());
|
|
21
22
|
registry->add(concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>());
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
namespace facebook::react {
|
|
18
18
|
|
|
19
|
+
using RNMapsCalloutComponentDescriptor = ConcreteComponentDescriptor<RNMapsCalloutShadowNode>;
|
|
19
20
|
using RNMapsGoogleMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsGoogleMapViewShadowNode>;
|
|
20
21
|
using RNMapsGooglePolygonComponentDescriptor = ConcreteComponentDescriptor<RNMapsGooglePolygonShadowNode>;
|
|
21
22
|
using RNMapsMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsMapViewShadowNode>;
|
|
@@ -13,6 +13,28 @@
|
|
|
13
13
|
|
|
14
14
|
namespace facebook::react {
|
|
15
15
|
|
|
16
|
+
void RNMapsCalloutEventEmitter::onPress(OnPress $event) const {
|
|
17
|
+
dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
|
+
auto $payload = jsi::Object(runtime);
|
|
19
|
+
$payload.setProperty(runtime, "action", $event.action);
|
|
20
|
+
$payload.setProperty(runtime, "id", $event.id);
|
|
21
|
+
{
|
|
22
|
+
auto coordinate = jsi::Object(runtime);
|
|
23
|
+
coordinate.setProperty(runtime, "latitude", $event.coordinate.latitude);
|
|
24
|
+
coordinate.setProperty(runtime, "longitude", $event.coordinate.longitude);
|
|
25
|
+
$payload.setProperty(runtime, "coordinate", coordinate);
|
|
26
|
+
}
|
|
27
|
+
{
|
|
28
|
+
auto position = jsi::Object(runtime);
|
|
29
|
+
position.setProperty(runtime, "x", $event.position.x);
|
|
30
|
+
position.setProperty(runtime, "y", $event.position.y);
|
|
31
|
+
$payload.setProperty(runtime, "position", position);
|
|
32
|
+
}
|
|
33
|
+
return $payload;
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
16
38
|
void RNMapsGoogleMapViewEventEmitter::onIndoorBuildingFocused(OnIndoorBuildingFocused $event) const {
|
|
17
39
|
dispatchEvent("indoorBuildingFocused", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
18
40
|
auto $payload = jsi::Object(runtime);
|
|
@@ -13,6 +13,28 @@
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
namespace facebook::react {
|
|
16
|
+
class RNMapsCalloutEventEmitter : public ViewEventEmitter {
|
|
17
|
+
public:
|
|
18
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
19
|
+
|
|
20
|
+
struct OnPressCoordinate {
|
|
21
|
+
double latitude;
|
|
22
|
+
double longitude;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
struct OnPressPosition {
|
|
26
|
+
double x;
|
|
27
|
+
double y;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
struct OnPress {
|
|
31
|
+
std::string action;
|
|
32
|
+
std::string id;
|
|
33
|
+
OnPressCoordinate coordinate;
|
|
34
|
+
OnPressPosition position;
|
|
35
|
+
};
|
|
36
|
+
void onPress(OnPress value) const;
|
|
37
|
+
};
|
|
16
38
|
class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
|
|
17
39
|
public:
|
|
18
40
|
using ViewEventEmitter::ViewEventEmitter;
|
|
@@ -15,6 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
namespace facebook::react {
|
|
17
17
|
|
|
18
|
+
RNMapsCalloutProps::RNMapsCalloutProps(
|
|
19
|
+
const PropsParserContext &context,
|
|
20
|
+
const RNMapsCalloutProps &sourceProps,
|
|
21
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
22
|
+
|
|
23
|
+
alphaHitTest(convertRawProp(context, rawProps, "alphaHitTest", sourceProps.alphaHitTest, {false})),
|
|
24
|
+
tooltip(convertRawProp(context, rawProps, "tooltip", sourceProps.tooltip, {false}))
|
|
25
|
+
{}
|
|
18
26
|
RNMapsGoogleMapViewProps::RNMapsGoogleMapViewProps(
|
|
19
27
|
const PropsParserContext &context,
|
|
20
28
|
const RNMapsGoogleMapViewProps &sourceProps,
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
|
|
19
19
|
namespace facebook::react {
|
|
20
20
|
|
|
21
|
+
class RNMapsCalloutProps final : public ViewProps {
|
|
22
|
+
public:
|
|
23
|
+
RNMapsCalloutProps() = default;
|
|
24
|
+
RNMapsCalloutProps(const PropsParserContext& context, const RNMapsCalloutProps &sourceProps, const RawProps &rawProps);
|
|
25
|
+
|
|
26
|
+
#pragma mark - Props
|
|
27
|
+
|
|
28
|
+
bool alphaHitTest{false};
|
|
29
|
+
bool tooltip{false};
|
|
30
|
+
};
|
|
31
|
+
|
|
21
32
|
enum class RNMapsGoogleMapViewMapType { Hybrid, MutedStandard, None, Satellite, Standard, Terrain, SatelliteFlyover, HybridFlyover };
|
|
22
33
|
|
|
23
34
|
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsGoogleMapViewMapType &result) {
|
|
@@ -30,6 +30,8 @@
|
|
|
30
30
|
#import <optional>
|
|
31
31
|
#import <vector>
|
|
32
32
|
|
|
33
|
+
|
|
34
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
33
35
|
namespace JS {
|
|
34
36
|
namespace NativeAirMapsModule {
|
|
35
37
|
struct LatLng {
|
|
@@ -131,4 +133,5 @@ inline double JS::NativeAirMapsModule::Point::y() const
|
|
|
131
133
|
id const p = _v[@"y"];
|
|
132
134
|
return RCTBridgingToDouble(p);
|
|
133
135
|
}
|
|
136
|
+
NS_ASSUME_NONNULL_END
|
|
134
137
|
#endif // RNMapsSpecs_H
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
namespace facebook::react {
|
|
14
14
|
|
|
15
|
+
extern const char RNMapsCalloutComponentName[] = "RNMapsCallout";
|
|
15
16
|
extern const char RNMapsGoogleMapViewComponentName[] = "RNMapsGoogleMapView";
|
|
16
17
|
extern const char RNMapsGooglePolygonComponentName[] = "RNMapsGooglePolygon";
|
|
17
18
|
extern const char RNMapsMapViewComponentName[] = "RNMapsMapView";
|
|
@@ -18,6 +18,17 @@
|
|
|
18
18
|
|
|
19
19
|
namespace facebook::react {
|
|
20
20
|
|
|
21
|
+
JSI_EXPORT extern const char RNMapsCalloutComponentName[];
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* `ShadowNode` for <RNMapsCallout> component.
|
|
25
|
+
*/
|
|
26
|
+
using RNMapsCalloutShadowNode = ConcreteViewShadowNode<
|
|
27
|
+
RNMapsCalloutComponentName,
|
|
28
|
+
RNMapsCalloutProps,
|
|
29
|
+
RNMapsCalloutEventEmitter,
|
|
30
|
+
RNMapsCalloutState>;
|
|
31
|
+
|
|
21
32
|
JSI_EXPORT extern const char RNMapsGoogleMapViewComponentName[];
|
|
22
33
|
|
|
23
34
|
/*
|
|
@@ -14,6 +14,18 @@
|
|
|
14
14
|
|
|
15
15
|
namespace facebook::react {
|
|
16
16
|
|
|
17
|
+
class RNMapsCalloutState {
|
|
18
|
+
public:
|
|
19
|
+
RNMapsCalloutState() = default;
|
|
20
|
+
|
|
21
|
+
#ifdef ANDROID
|
|
22
|
+
RNMapsCalloutState(RNMapsCalloutState const &previousState, folly::dynamic data){};
|
|
23
|
+
folly::dynamic getDynamic() const {
|
|
24
|
+
return {};
|
|
25
|
+
};
|
|
26
|
+
#endif
|
|
27
|
+
};
|
|
28
|
+
|
|
17
29
|
class RNMapsGoogleMapViewState {
|
|
18
30
|
public:
|
|
19
31
|
RNMapsGoogleMapViewState() = default;
|
|
@@ -176,8 +176,12 @@ public:
|
|
|
176
176
|
template <typename T>
|
|
177
177
|
class JSI_EXPORT NativeAirMapsModuleCxxSpec : public TurboModule {
|
|
178
178
|
public:
|
|
179
|
-
jsi::Value
|
|
180
|
-
return delegate_.
|
|
179
|
+
jsi::Value create(jsi::Runtime &rt, const jsi::PropNameID &propName) override {
|
|
180
|
+
return delegate_.create(rt, propName);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
std::vector<jsi::PropNameID> getPropertyNames(jsi::Runtime& runtime) override {
|
|
184
|
+
return delegate_.getPropertyNames(runtime);
|
|
181
185
|
}
|
|
182
186
|
|
|
183
187
|
static constexpr std::string_view kModuleName = "RNMapsAirModule";
|
package/lib/MapCallout.js
CHANGED
|
@@ -34,6 +34,7 @@ class MapCallout extends React.Component {
|
|
|
34
34
|
render() {
|
|
35
35
|
const { tooltip = false, alphaHitTest = false } = this.props;
|
|
36
36
|
const AIRMapCallout = this.getNativeComponent();
|
|
37
|
+
console.log('renderCallout ' + AIRMapCallout);
|
|
37
38
|
return (<AIRMapCallout {...this.props} tooltip={tooltip} alphaHitTest={alphaHitTest} style={[styles.callout, this.props.style]}/>);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -9,6 +9,7 @@ const react_native_1 = require("react-native");
|
|
|
9
9
|
const ProviderConstants_1 = require("./ProviderConstants");
|
|
10
10
|
const NativeComponentGooglePolygon_1 = __importDefault(require("./specs/NativeComponentGooglePolygon"));
|
|
11
11
|
const NativeComponentMarker_1 = __importDefault(require("./specs/NativeComponentMarker"));
|
|
12
|
+
const NativeComponentCallout_1 = __importDefault(require("./specs/NativeComponentCallout"));
|
|
12
13
|
exports.SUPPORTED = 'SUPPORTED';
|
|
13
14
|
exports.USES_DEFAULT_IMPLEMENTATION = 'USES_DEFAULT_IMPLEMENTATION';
|
|
14
15
|
exports.NOT_SUPPORTED = 'NOT_SUPPORTED';
|
|
@@ -44,6 +45,10 @@ function decorateMapComponent(Component, componentName, providers) {
|
|
|
44
45
|
// @ts-ignore
|
|
45
46
|
return NativeComponentMarker_1.default;
|
|
46
47
|
}
|
|
48
|
+
if (componentName === 'Callout' && react_native_1.Platform.OS === 'android') {
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
return NativeComponentCallout_1.default;
|
|
51
|
+
}
|
|
47
52
|
const key = provider || 'default';
|
|
48
53
|
if (components[key]) {
|
|
49
54
|
return components[key];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import { Double, BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
export type LatLng = Readonly<{
|
|
4
|
+
latitude: Double;
|
|
5
|
+
longitude: Double;
|
|
6
|
+
}>;
|
|
7
|
+
export type CalloutPressEvent = BubblingEventHandler<Readonly<{
|
|
8
|
+
action?: string;
|
|
9
|
+
id: string;
|
|
10
|
+
coordinate: {
|
|
11
|
+
latitude: Double;
|
|
12
|
+
longitude: Double;
|
|
13
|
+
};
|
|
14
|
+
position?: {
|
|
15
|
+
x: Double;
|
|
16
|
+
y: Double;
|
|
17
|
+
};
|
|
18
|
+
}>>;
|
|
19
|
+
export interface CalloutFabricNativeProps extends ViewProps {
|
|
20
|
+
/**
|
|
21
|
+
* If `true`, clicks on transparent areas in callout will be passed to map.
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
* @platform iOS: Supported
|
|
25
|
+
* @platform Android: Not supported
|
|
26
|
+
*/
|
|
27
|
+
alphaHitTest?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Callback that is called when the user presses on the callout
|
|
30
|
+
*
|
|
31
|
+
* @platform iOS: Apple Maps only
|
|
32
|
+
* @platform Android: Supported
|
|
33
|
+
*/
|
|
34
|
+
onPress?: CalloutPressEvent;
|
|
35
|
+
/**
|
|
36
|
+
* If `false`, a default "tooltip" bubble window will be drawn around this callouts children.
|
|
37
|
+
* If `true`, the child views can fully customize their appearance, including any "bubble" like styles.
|
|
38
|
+
*
|
|
39
|
+
* @default false
|
|
40
|
+
* @platform iOS: Supported
|
|
41
|
+
* @platform Android: Supported
|
|
42
|
+
*/
|
|
43
|
+
tooltip?: boolean;
|
|
44
|
+
}
|
|
45
|
+
declare const _default: HostComponent<CalloutFabricNativeProps>;
|
|
46
|
+
export default _default;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const codegenNativeComponent_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
|
|
7
|
+
exports.default = (0, codegenNativeComponent_1.default)('RNMapsCallout', {
|
|
8
|
+
excludedPlatforms: ['iOS'],
|
|
9
|
+
});
|
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.66",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|