react-native-maps 1.25.6 → 1.26.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/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +6 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +3 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +11 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +2 -1
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +2 -1
- package/ios/AirMaps/AIRMap.h +2 -0
- package/ios/AirMaps/AIRMap.mm +181 -0
- package/ios/AirMaps/RNMapsMapView.mm +8 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +3 -2
- package/ios/generated/RNMapsSpecs/Props.h +3 -2
- package/package.json +1 -1
- package/src/MapView.tsx +17 -0
- package/src/sharedTypes.ts +91 -0
- package/src/specs/NativeComponentGoogleMapView.ts +0 -10
- package/src/specs/NativeComponentMapView.ts +19 -0
package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java
CHANGED
|
@@ -124,6 +124,12 @@ public class RNMapsMapViewManagerDelegate<T extends View, U extends BaseViewMana
|
|
|
124
124
|
case "showsIndoors":
|
|
125
125
|
mViewManager.setShowsIndoors(view, value == null ? true : (boolean) value);
|
|
126
126
|
break;
|
|
127
|
+
case "showsPointsOfInterests":
|
|
128
|
+
mViewManager.setShowsPointsOfInterests(view, value == null ? true : (boolean) value);
|
|
129
|
+
break;
|
|
130
|
+
case "pointsOfInterestFilter":
|
|
131
|
+
mViewManager.setPointsOfInterestFilter(view, (ReadableArray) value);
|
|
132
|
+
break;
|
|
127
133
|
case "showsMyLocationButton":
|
|
128
134
|
mViewManager.setShowsMyLocationButton(view, value == null ? false : (boolean) value);
|
|
129
135
|
break;
|
package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java
CHANGED
|
@@ -11,6 +11,7 @@ package com.facebook.react.viewmanagers;
|
|
|
11
11
|
|
|
12
12
|
import android.view.View;
|
|
13
13
|
import androidx.annotation.Nullable;
|
|
14
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
14
15
|
import com.facebook.react.bridge.ReadableMap;
|
|
15
16
|
|
|
16
17
|
public interface RNMapsMapViewManagerInterface<T extends View> {
|
|
@@ -47,6 +48,8 @@ public interface RNMapsMapViewManagerInterface<T extends View> {
|
|
|
47
48
|
void setShowsCompass(T view, boolean value);
|
|
48
49
|
void setShowsIndoorLevelPicker(T view, boolean value);
|
|
49
50
|
void setShowsIndoors(T view, boolean value);
|
|
51
|
+
void setShowsPointsOfInterests(T view, boolean value);
|
|
52
|
+
void setPointsOfInterestFilter(T view, @Nullable ReadableArray value);
|
|
50
53
|
void setShowsMyLocationButton(T view, boolean value);
|
|
51
54
|
void setShowsScale(T view, boolean value);
|
|
52
55
|
void setShowsUserLocation(T view, boolean value);
|
|
@@ -14,6 +14,7 @@ import org.json.JSONException;
|
|
|
14
14
|
import org.json.JSONObject;
|
|
15
15
|
|
|
16
16
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
17
18
|
import com.facebook.react.bridge.ReadableMap;
|
|
18
19
|
import com.facebook.react.bridge.WritableArray;
|
|
19
20
|
import com.facebook.react.bridge.WritableMap;
|
|
@@ -430,6 +431,16 @@ public class MapViewManager extends ViewGroupManager<MapView> implements RNMapsM
|
|
|
430
431
|
view.setShowIndoors(value);
|
|
431
432
|
}
|
|
432
433
|
|
|
434
|
+
@Override
|
|
435
|
+
public void setShowsPointsOfInterests(MapView view, boolean value) {
|
|
436
|
+
// not supported
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
@Override
|
|
440
|
+
public void setPointsOfInterestFilter(MapView view, @Nullable ReadableArray value) {
|
|
441
|
+
// not supported
|
|
442
|
+
}
|
|
443
|
+
|
|
433
444
|
@Override
|
|
434
445
|
public void setShowsMyLocationButton(MapView view, boolean value) {
|
|
435
446
|
view.setShowsMyLocationButton(value);
|
|
@@ -61,7 +61,6 @@ RNMapsGoogleMapViewProps::RNMapsGoogleMapViewProps(
|
|
|
61
61
|
showsIndoorLevelPicker(convertRawProp(context, rawProps, "showsIndoorLevelPicker", sourceProps.showsIndoorLevelPicker, {false})),
|
|
62
62
|
showsIndoors(convertRawProp(context, rawProps, "showsIndoors", sourceProps.showsIndoors, {true})),
|
|
63
63
|
showsMyLocationButton(convertRawProp(context, rawProps, "showsMyLocationButton", sourceProps.showsMyLocationButton, {false})),
|
|
64
|
-
showsPointsOfInterest(convertRawProp(context, rawProps, "showsPointsOfInterest", sourceProps.showsPointsOfInterest, {false})),
|
|
65
64
|
showsScale(convertRawProp(context, rawProps, "showsScale", sourceProps.showsScale, {false})),
|
|
66
65
|
showsTraffic(convertRawProp(context, rawProps, "showsTraffic", sourceProps.showsTraffic, {false})),
|
|
67
66
|
showsUserLocation(convertRawProp(context, rawProps, "showsUserLocation", sourceProps.showsUserLocation, {false})),
|
|
@@ -126,6 +125,8 @@ RNMapsMapViewProps::RNMapsMapViewProps(
|
|
|
126
125
|
showsCompass(convertRawProp(context, rawProps, "showsCompass", sourceProps.showsCompass, {true})),
|
|
127
126
|
showsIndoorLevelPicker(convertRawProp(context, rawProps, "showsIndoorLevelPicker", sourceProps.showsIndoorLevelPicker, {false})),
|
|
128
127
|
showsIndoors(convertRawProp(context, rawProps, "showsIndoors", sourceProps.showsIndoors, {true})),
|
|
128
|
+
showsPointsOfInterests(convertRawProp(context, rawProps, "showsPointsOfInterests", sourceProps.showsPointsOfInterests, {true})),
|
|
129
|
+
pointsOfInterestFilter(convertRawProp(context, rawProps, "pointsOfInterestFilter", sourceProps.pointsOfInterestFilter, {})),
|
|
129
130
|
showsMyLocationButton(convertRawProp(context, rawProps, "showsMyLocationButton", sourceProps.showsMyLocationButton, {false})),
|
|
130
131
|
showsScale(convertRawProp(context, rawProps, "showsScale", sourceProps.showsScale, {false})),
|
|
131
132
|
showsUserLocation(convertRawProp(context, rawProps, "showsUserLocation", sourceProps.showsUserLocation, {false})),
|
|
@@ -386,7 +386,6 @@ class RNMapsGoogleMapViewProps final : public ViewProps {
|
|
|
386
386
|
bool showsIndoorLevelPicker{false};
|
|
387
387
|
bool showsIndoors{true};
|
|
388
388
|
bool showsMyLocationButton{false};
|
|
389
|
-
bool showsPointsOfInterest{false};
|
|
390
389
|
bool showsScale{false};
|
|
391
390
|
bool showsTraffic{false};
|
|
392
391
|
bool showsUserLocation{false};
|
|
@@ -913,6 +912,8 @@ class RNMapsMapViewProps final : public ViewProps {
|
|
|
913
912
|
bool showsCompass{true};
|
|
914
913
|
bool showsIndoorLevelPicker{false};
|
|
915
914
|
bool showsIndoors{true};
|
|
915
|
+
bool showsPointsOfInterests{true};
|
|
916
|
+
std::vector<std::string> pointsOfInterestFilter{};
|
|
916
917
|
bool showsMyLocationButton{false};
|
|
917
918
|
bool showsScale{false};
|
|
918
919
|
bool showsUserLocation{false};
|
package/ios/AirMaps/AIRMap.h
CHANGED
|
@@ -49,6 +49,8 @@ extern const NSInteger AIRMapMaxZoomLevel;
|
|
|
49
49
|
@property (nonatomic, assign) CGFloat maxZoom;
|
|
50
50
|
@property (nonatomic, assign) CGPoint compassOffset;
|
|
51
51
|
@property (nonatomic, assign) UIEdgeInsets mapPadding;
|
|
52
|
+
@property (nonatomic, assign) BOOL showsPointsOfInterests;
|
|
53
|
+
@property (nonatomic, copy) NSArray<NSString *> *pointsOfInterestFilter;
|
|
52
54
|
|
|
53
55
|
@property (nonatomic, assign) CLLocationCoordinate2D pendingCenter;
|
|
54
56
|
@property (nonatomic, assign) MKCoordinateSpan pendingSpan;
|
package/ios/AirMaps/AIRMap.mm
CHANGED
|
@@ -58,6 +58,8 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
58
58
|
BOOL _initialCameraSet;
|
|
59
59
|
BOOL _initialized;
|
|
60
60
|
BOOL _loadingStarted;
|
|
61
|
+
BOOL _showsPointsOfInterests;
|
|
62
|
+
NSArray<NSString *> *_pointsOfInterestFilter;
|
|
61
63
|
|
|
62
64
|
// Array to manually track RN subviews
|
|
63
65
|
//
|
|
@@ -97,6 +99,8 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
97
99
|
self.compassOffset = CGPointMake(0, 0);
|
|
98
100
|
self.legacyZoomConstraintsEnabled = YES;
|
|
99
101
|
_initialized = YES;
|
|
102
|
+
_showsPointsOfInterests = YES;
|
|
103
|
+
_pointsOfInterestFilter = @[];
|
|
100
104
|
[self listenToMemoryWarnings];
|
|
101
105
|
}
|
|
102
106
|
return self;
|
|
@@ -637,6 +641,75 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
637
641
|
}
|
|
638
642
|
}
|
|
639
643
|
|
|
644
|
+
- (void)setShowsPointsOfInterests:(BOOL)showsPointsOfInterests {
|
|
645
|
+
_showsPointsOfInterests = showsPointsOfInterests;
|
|
646
|
+
|
|
647
|
+
if (!_initialized) {
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
if (_pointsOfInterestFilter && _pointsOfInterestFilter.count > 0) {
|
|
652
|
+
return; // specific filter takes precedence
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
if (@available(iOS 16.0, *)) {
|
|
656
|
+
MKMapConfiguration *newConfig = [self.preferredConfiguration copy] ?: [[MKStandardMapConfiguration alloc] init];
|
|
657
|
+
MKPointOfInterestFilter *filter = showsPointsOfInterests
|
|
658
|
+
? [MKPointOfInterestFilter filterIncludingAllCategories]
|
|
659
|
+
: [MKPointOfInterestFilter filterExcludingAllCategories];
|
|
660
|
+
|
|
661
|
+
if ([newConfig isKindOfClass:[MKStandardMapConfiguration class]]) {
|
|
662
|
+
((MKStandardMapConfiguration *)newConfig).pointOfInterestFilter = filter;
|
|
663
|
+
} else if ([newConfig isKindOfClass:[MKHybridMapConfiguration class]]) {
|
|
664
|
+
((MKHybridMapConfiguration *)newConfig).pointOfInterestFilter = filter;
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
self.preferredConfiguration = newConfig;
|
|
668
|
+
} else {
|
|
669
|
+
self.showsPointsOfInterest = showsPointsOfInterests;
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
- (void)setPointsOfInterestFilter:(NSArray<NSString *> *)pointsOfInterestFilter {
|
|
674
|
+
_pointsOfInterestFilter = pointsOfInterestFilter;
|
|
675
|
+
|
|
676
|
+
if (!_initialized) {
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// If the filter is nil or empty, fall back to the boolean prop's behavior.
|
|
681
|
+
if (!pointsOfInterestFilter || pointsOfInterestFilter.count == 0) {
|
|
682
|
+
[self setShowsPointsOfInterests:_showsPointsOfInterests];
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
// --- Convert input strings into valid MKPointOfInterestCategory constants ---
|
|
687
|
+
NSArray<MKPointOfInterestCategory> *validCategories = [self getCategoriesFromStrings:pointsOfInterestFilter];
|
|
688
|
+
|
|
689
|
+
// If no valid categories were found from the input strings, do nothing.
|
|
690
|
+
if (validCategories.count == 0) {
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
MKPointOfInterestFilter *filter =
|
|
695
|
+
[[MKPointOfInterestFilter alloc] initIncludingCategories:validCategories];
|
|
696
|
+
|
|
697
|
+
if (@available(iOS 16.0, *)) {
|
|
698
|
+
MKMapConfiguration *newConfig =
|
|
699
|
+
[self.preferredConfiguration copy] ?: [[MKStandardMapConfiguration alloc] init];
|
|
700
|
+
|
|
701
|
+
if ([newConfig isKindOfClass:[MKStandardMapConfiguration class]]) {
|
|
702
|
+
((MKStandardMapConfiguration *)newConfig).pointOfInterestFilter = filter;
|
|
703
|
+
} else if ([newConfig isKindOfClass:[MKHybridMapConfiguration class]]) {
|
|
704
|
+
((MKHybridMapConfiguration *)newConfig).pointOfInterestFilter = filter;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
self.preferredConfiguration = newConfig;
|
|
708
|
+
} else {
|
|
709
|
+
self.pointOfInterestFilter = filter;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
|
|
640
713
|
- (UIColor *)loadingBackgroundColor {
|
|
641
714
|
return self.loadingView.backgroundColor;
|
|
642
715
|
}
|
|
@@ -901,4 +974,112 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
901
974
|
return log2(360 * ((width / normalizingFactor) / spanStraight));
|
|
902
975
|
}
|
|
903
976
|
|
|
977
|
+
// Helpers
|
|
978
|
+
|
|
979
|
+
- (NSArray<MKPointOfInterestCategory> *)getCategoriesFromStrings:(NSArray<NSString *> *)stringArray {
|
|
980
|
+
// Use a static dictionary so it's only created once for efficiency.
|
|
981
|
+
static NSDictionary<NSString *, MKPointOfInterestCategory> *categoryMap = nil;
|
|
982
|
+
static dispatch_once_t onceToken;
|
|
983
|
+
dispatch_once(&onceToken, ^{
|
|
984
|
+
NSMutableDictionary<NSString *, MKPointOfInterestCategory> *map = [NSMutableDictionary dictionary];
|
|
985
|
+
|
|
986
|
+
// --- Categories available since iOS 13.0 ---
|
|
987
|
+
map[@"airport"] = MKPointOfInterestCategoryAirport;
|
|
988
|
+
map[@"amusementPark"] = MKPointOfInterestCategoryAmusementPark;
|
|
989
|
+
map[@"aquarium"] = MKPointOfInterestCategoryAquarium;
|
|
990
|
+
map[@"atm"] = MKPointOfInterestCategoryATM;
|
|
991
|
+
map[@"bakery"] = MKPointOfInterestCategoryBakery;
|
|
992
|
+
map[@"bank"] = MKPointOfInterestCategoryBank;
|
|
993
|
+
map[@"beach"] = MKPointOfInterestCategoryBeach;
|
|
994
|
+
map[@"brewery"] = MKPointOfInterestCategoryBrewery;
|
|
995
|
+
map[@"cafe"] = MKPointOfInterestCategoryCafe;
|
|
996
|
+
map[@"campground"] = MKPointOfInterestCategoryCampground;
|
|
997
|
+
map[@"carRental"] = MKPointOfInterestCategoryCarRental;
|
|
998
|
+
map[@"evCharger"] = MKPointOfInterestCategoryEVCharger;
|
|
999
|
+
map[@"fireStation"] = MKPointOfInterestCategoryFireStation;
|
|
1000
|
+
map[@"fitnessCenter"] = MKPointOfInterestCategoryFitnessCenter;
|
|
1001
|
+
map[@"foodMarket"] = MKPointOfInterestCategoryFoodMarket;
|
|
1002
|
+
map[@"gasStation"] = MKPointOfInterestCategoryGasStation;
|
|
1003
|
+
map[@"hospital"] = MKPointOfInterestCategoryHospital;
|
|
1004
|
+
map[@"hotel"] = MKPointOfInterestCategoryHotel;
|
|
1005
|
+
map[@"laundry"] = MKPointOfInterestCategoryLaundry;
|
|
1006
|
+
map[@"library"] = MKPointOfInterestCategoryLibrary;
|
|
1007
|
+
map[@"marina"] = MKPointOfInterestCategoryMarina;
|
|
1008
|
+
map[@"movieTheater"] = MKPointOfInterestCategoryMovieTheater;
|
|
1009
|
+
map[@"museum"] = MKPointOfInterestCategoryMuseum;
|
|
1010
|
+
map[@"nationalPark"] = MKPointOfInterestCategoryNationalPark;
|
|
1011
|
+
map[@"nightlife"] = MKPointOfInterestCategoryNightlife;
|
|
1012
|
+
map[@"park"] = MKPointOfInterestCategoryPark;
|
|
1013
|
+
map[@"parking"] = MKPointOfInterestCategoryParking;
|
|
1014
|
+
map[@"pharmacy"] = MKPointOfInterestCategoryPharmacy;
|
|
1015
|
+
map[@"police"] = MKPointOfInterestCategoryPolice;
|
|
1016
|
+
map[@"postOffice"] = MKPointOfInterestCategoryPostOffice;
|
|
1017
|
+
map[@"publicTransport"] = MKPointOfInterestCategoryPublicTransport;
|
|
1018
|
+
map[@"restaurant"] = MKPointOfInterestCategoryRestaurant;
|
|
1019
|
+
map[@"restroom"] = MKPointOfInterestCategoryRestroom;
|
|
1020
|
+
map[@"school"] = MKPointOfInterestCategorySchool;
|
|
1021
|
+
map[@"stadium"] = MKPointOfInterestCategoryStadium;
|
|
1022
|
+
map[@"store"] = MKPointOfInterestCategoryStore;
|
|
1023
|
+
map[@"theater"] = MKPointOfInterestCategoryTheater;
|
|
1024
|
+
map[@"university"] = MKPointOfInterestCategoryUniversity;
|
|
1025
|
+
map[@"winery"] = MKPointOfInterestCategoryWinery;
|
|
1026
|
+
map[@"zoo"] = MKPointOfInterestCategoryZoo;
|
|
1027
|
+
|
|
1028
|
+
// Only include if building with iOS 18.0+ SDK (Xcode 16+)
|
|
1029
|
+
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 180000
|
|
1030
|
+
// --- Categories available since iOS 18.0 ---
|
|
1031
|
+
if (@available(iOS 18.0, *)) {
|
|
1032
|
+
map[@"animalService"] = MKPointOfInterestCategoryAnimalService;
|
|
1033
|
+
map[@"automotiveRepair"] = MKPointOfInterestCategoryAutomotiveRepair;
|
|
1034
|
+
map[@"baseball"] = MKPointOfInterestCategoryBaseball;
|
|
1035
|
+
map[@"basketball"] = MKPointOfInterestCategoryBasketball;
|
|
1036
|
+
map[@"beauty"] = MKPointOfInterestCategoryBeauty;
|
|
1037
|
+
map[@"bowling"] = MKPointOfInterestCategoryBowling;
|
|
1038
|
+
map[@"castle"] = MKPointOfInterestCategoryCastle;
|
|
1039
|
+
map[@"conventionCenter"] = MKPointOfInterestCategoryConventionCenter;
|
|
1040
|
+
map[@"distillery"] = MKPointOfInterestCategoryDistillery;
|
|
1041
|
+
map[@"fairground"] = MKPointOfInterestCategoryFairground;
|
|
1042
|
+
map[@"fishing"] = MKPointOfInterestCategoryFishing;
|
|
1043
|
+
|
|
1044
|
+
map[@"fortress"] = MKPointOfInterestCategoryFortress;
|
|
1045
|
+
map[@"golf"] = MKPointOfInterestCategoryGolf;
|
|
1046
|
+
map[@"goKart"] = MKPointOfInterestCategoryGoKart;
|
|
1047
|
+
map[@"hiking"] = MKPointOfInterestCategoryHiking;
|
|
1048
|
+
map[@"kayaking"] = MKPointOfInterestCategoryKayaking;
|
|
1049
|
+
map[@"landmark"] = MKPointOfInterestCategoryLandmark;
|
|
1050
|
+
map[@"mailbox"] = MKPointOfInterestCategoryMailbox;
|
|
1051
|
+
map[@"miniGolf"] = MKPointOfInterestCategoryMiniGolf;
|
|
1052
|
+
map[@"musicVenue"] = MKPointOfInterestCategoryMusicVenue;
|
|
1053
|
+
map[@"nationalMonument"] = MKPointOfInterestCategoryNationalMonument;
|
|
1054
|
+
map[@"planetarium"] = MKPointOfInterestCategoryPlanetarium;
|
|
1055
|
+
map[@"rockClimbing"] = MKPointOfInterestCategoryRockClimbing;
|
|
1056
|
+
map[@"rvPark"] = MKPointOfInterestCategoryRVPark;
|
|
1057
|
+
map[@"skatePark"] = MKPointOfInterestCategorySkatePark;
|
|
1058
|
+
map[@"skating"] = MKPointOfInterestCategorySkating;
|
|
1059
|
+
map[@"skiing"] = MKPointOfInterestCategorySkiing;
|
|
1060
|
+
map[@"soccer"] = MKPointOfInterestCategorySoccer;
|
|
1061
|
+
map[@"spa"] = MKPointOfInterestCategorySpa;
|
|
1062
|
+
map[@"surfing"] = MKPointOfInterestCategorySurfing;
|
|
1063
|
+
map[@"swimming"] = MKPointOfInterestCategorySwimming;
|
|
1064
|
+
map[@"tennis"] = MKPointOfInterestCategoryTennis;
|
|
1065
|
+
map[@"volleyball"] = MKPointOfInterestCategoryVolleyball;
|
|
1066
|
+
}
|
|
1067
|
+
#endif
|
|
1068
|
+
|
|
1069
|
+
categoryMap = [map copy];
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
NSMutableArray<MKPointOfInterestCategory> *validCategories = [NSMutableArray array];
|
|
1073
|
+
for (NSString *str in stringArray) {
|
|
1074
|
+
// Direct, case-sensitive lookup for camelCase keys
|
|
1075
|
+
MKPointOfInterestCategory category = categoryMap[str];
|
|
1076
|
+
if (category) {
|
|
1077
|
+
[validCategories addObject:category];
|
|
1078
|
+
} else {
|
|
1079
|
+
NSLog(@"[MapView] Warning: Unknown or unavailable point of interest category string '%@'", str);
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
return validCategories;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
904
1085
|
@end
|
|
@@ -563,6 +563,7 @@ newViewProps.name.right); \
|
|
|
563
563
|
REMAP_MAPVIEW_PROP(pitchEnabled)
|
|
564
564
|
REMAP_MAPVIEW_PROP(showsBuildings)
|
|
565
565
|
REMAP_MAPVIEW_PROP(rotateEnabled)
|
|
566
|
+
REMAP_MAPVIEW_PROP(showsPointsOfInterests)
|
|
566
567
|
|
|
567
568
|
REMAP_MAPVIEW_POINT_PROP(compassOffset)
|
|
568
569
|
|
|
@@ -610,6 +611,13 @@ newViewProps.name.right); \
|
|
|
610
611
|
[_view setCameraZoomRange:zoomRange animated:newViewProps.cameraZoomRange.animated];
|
|
611
612
|
}
|
|
612
613
|
|
|
614
|
+
if (oldViewProps.pointsOfInterestFilter != newViewProps.pointsOfInterestFilter) {
|
|
615
|
+
NSMutableArray<NSString *> *filterArray = [NSMutableArray new];
|
|
616
|
+
for (const auto& str : newViewProps.pointsOfInterestFilter) {
|
|
617
|
+
[filterArray addObject:RCTNSStringFromString(str)];
|
|
618
|
+
}
|
|
619
|
+
_view.pointsOfInterestFilter = filterArray;
|
|
620
|
+
}
|
|
613
621
|
|
|
614
622
|
[super updateProps:props oldProps:oldProps];
|
|
615
623
|
}
|
|
@@ -61,7 +61,6 @@ RNMapsGoogleMapViewProps::RNMapsGoogleMapViewProps(
|
|
|
61
61
|
showsIndoorLevelPicker(convertRawProp(context, rawProps, "showsIndoorLevelPicker", sourceProps.showsIndoorLevelPicker, {false})),
|
|
62
62
|
showsIndoors(convertRawProp(context, rawProps, "showsIndoors", sourceProps.showsIndoors, {true})),
|
|
63
63
|
showsMyLocationButton(convertRawProp(context, rawProps, "showsMyLocationButton", sourceProps.showsMyLocationButton, {false})),
|
|
64
|
-
showsPointsOfInterest(convertRawProp(context, rawProps, "showsPointsOfInterest", sourceProps.showsPointsOfInterest, {false})),
|
|
65
64
|
showsScale(convertRawProp(context, rawProps, "showsScale", sourceProps.showsScale, {false})),
|
|
66
65
|
showsTraffic(convertRawProp(context, rawProps, "showsTraffic", sourceProps.showsTraffic, {false})),
|
|
67
66
|
showsUserLocation(convertRawProp(context, rawProps, "showsUserLocation", sourceProps.showsUserLocation, {false})),
|
|
@@ -126,7 +125,9 @@ RNMapsMapViewProps::RNMapsMapViewProps(
|
|
|
126
125
|
showsCompass(convertRawProp(context, rawProps, "showsCompass", sourceProps.showsCompass, {true})),
|
|
127
126
|
showsIndoorLevelPicker(convertRawProp(context, rawProps, "showsIndoorLevelPicker", sourceProps.showsIndoorLevelPicker, {false})),
|
|
128
127
|
showsIndoors(convertRawProp(context, rawProps, "showsIndoors", sourceProps.showsIndoors, {true})),
|
|
129
|
-
|
|
128
|
+
showsPointsOfInterests(convertRawProp(context, rawProps, "showsPointsOfInterests", sourceProps.showsPointsOfInterests, {true})),
|
|
129
|
+
pointsOfInterestFilter(convertRawProp(context, rawProps, "pointsOfInterestFilter", sourceProps.pointsOfInterestFilter, {})),
|
|
130
|
+
showsMyLocationButton(convertRawProp(context, rawProps, "showsMyLocationButton", sourceProps.showsMyLocationButton, {false})),
|
|
130
131
|
showsScale(convertRawProp(context, rawProps, "showsScale", sourceProps.showsScale, {false})),
|
|
131
132
|
showsUserLocation(convertRawProp(context, rawProps, "showsUserLocation", sourceProps.showsUserLocation, {false})),
|
|
132
133
|
tintColor(convertRawProp(context, rawProps, "tintColor", sourceProps.tintColor, {})),
|
|
@@ -386,7 +386,6 @@ class RNMapsGoogleMapViewProps final : public ViewProps {
|
|
|
386
386
|
bool showsIndoorLevelPicker{false};
|
|
387
387
|
bool showsIndoors{true};
|
|
388
388
|
bool showsMyLocationButton{false};
|
|
389
|
-
bool showsPointsOfInterest{false};
|
|
390
389
|
bool showsScale{false};
|
|
391
390
|
bool showsTraffic{false};
|
|
392
391
|
bool showsUserLocation{false};
|
|
@@ -913,7 +912,9 @@ class RNMapsMapViewProps final : public ViewProps {
|
|
|
913
912
|
bool showsCompass{true};
|
|
914
913
|
bool showsIndoorLevelPicker{false};
|
|
915
914
|
bool showsIndoors{true};
|
|
916
|
-
bool
|
|
915
|
+
bool showsPointsOfInterests{true};
|
|
916
|
+
std::vector<std::string> pointsOfInterestFilter{};
|
|
917
|
+
bool showsMyLocationButton{false};
|
|
917
918
|
bool showsScale{false};
|
|
918
919
|
bool showsUserLocation{false};
|
|
919
920
|
SharedColor tintColor{};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "src/index.ts",
|
|
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.
|
|
8
|
+
"version": "1.26.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|
package/src/MapView.tsx
CHANGED
|
@@ -27,6 +27,7 @@ import type {
|
|
|
27
27
|
Point,
|
|
28
28
|
Provider,
|
|
29
29
|
Region,
|
|
30
|
+
MKPointOfInterestCategoryType,
|
|
30
31
|
} from './sharedTypes';
|
|
31
32
|
import type {
|
|
32
33
|
ActiveIndoorLevel,
|
|
@@ -587,6 +588,20 @@ export type MapViewProps = ViewProps & {
|
|
|
587
588
|
*/
|
|
588
589
|
showsMyLocationButton?: boolean;
|
|
589
590
|
|
|
591
|
+
/**
|
|
592
|
+
* A Boolean indicating whether points of interest should be displayed.
|
|
593
|
+
* Use `pointsOfInterestFilter` for more granular control.
|
|
594
|
+
* @see pointsOfInterestFilter
|
|
595
|
+
*/
|
|
596
|
+
showsPointsOfInterests?: boolean;
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* An array of category strings to show on the map.
|
|
600
|
+
* If this is set, it takes precedence over `showsPointsOfInterests`.
|
|
601
|
+
* @see showsPointsOfInterests
|
|
602
|
+
*/
|
|
603
|
+
pointsOfInterestFilter?: MKPointOfInterestCategoryType[];
|
|
604
|
+
|
|
590
605
|
/**
|
|
591
606
|
* A Boolean indicating whether the map shows scale information.
|
|
592
607
|
*
|
|
@@ -1166,6 +1181,8 @@ class MapView extends React.Component<MapViewProps, State> {
|
|
|
1166
1181
|
// @ts-ignore
|
|
1167
1182
|
onIndoorLevelActivated: this.handleIndoorLevelActivated,
|
|
1168
1183
|
onLongPress: this.handleLongPress,
|
|
1184
|
+
showsPointsOfInterests: this.props.showsPointsOfInterests,
|
|
1185
|
+
pointsOfInterestFilter: this.props.pointsOfInterestFilter,
|
|
1169
1186
|
...restProps,
|
|
1170
1187
|
};
|
|
1171
1188
|
if (this.props.region) {
|
package/src/sharedTypes.ts
CHANGED
|
@@ -99,3 +99,94 @@ export type MarkerPressEvent = NativeSyntheticEvent<{
|
|
|
99
99
|
*/
|
|
100
100
|
position?: Point;
|
|
101
101
|
}>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Represents the available categories for points of interest on the Apple Maps.
|
|
105
|
+
* Use an array of these strings for the `pointsOfInterestFilter` prop.
|
|
106
|
+
* More: https://developer.apple.com/documentation/mapkit/mkpointofinterestcategory
|
|
107
|
+
*/
|
|
108
|
+
export type MKPointOfInterestCategoryType =
|
|
109
|
+
// Arts and culture
|
|
110
|
+
| 'museum'
|
|
111
|
+
| 'musicVenue'
|
|
112
|
+
| 'theater'
|
|
113
|
+
// Education
|
|
114
|
+
| 'library'
|
|
115
|
+
| 'planetarium'
|
|
116
|
+
| 'school'
|
|
117
|
+
| 'university'
|
|
118
|
+
// Entertainment
|
|
119
|
+
| 'movieTheater'
|
|
120
|
+
| 'nightlife'
|
|
121
|
+
// Health and safety
|
|
122
|
+
| 'fireStation'
|
|
123
|
+
| 'hospital'
|
|
124
|
+
| 'pharmacy'
|
|
125
|
+
| 'police'
|
|
126
|
+
// Historical and cultural landmarks
|
|
127
|
+
| 'castle'
|
|
128
|
+
| 'fortress'
|
|
129
|
+
| 'landmark'
|
|
130
|
+
| 'nationalMonument'
|
|
131
|
+
// Food and drink
|
|
132
|
+
| 'bakery'
|
|
133
|
+
| 'brewery'
|
|
134
|
+
| 'cafe'
|
|
135
|
+
| 'distillery'
|
|
136
|
+
| 'foodMarket'
|
|
137
|
+
| 'restaurant'
|
|
138
|
+
| 'winery'
|
|
139
|
+
// Personal services
|
|
140
|
+
| 'animalService'
|
|
141
|
+
| 'atm'
|
|
142
|
+
| 'automotiveRepair'
|
|
143
|
+
| 'bank'
|
|
144
|
+
| 'beauty'
|
|
145
|
+
| 'evCharger'
|
|
146
|
+
| 'fitnessCenter'
|
|
147
|
+
| 'laundry'
|
|
148
|
+
| 'mailbox'
|
|
149
|
+
| 'postOffice'
|
|
150
|
+
| 'restroom'
|
|
151
|
+
| 'spa'
|
|
152
|
+
| 'store'
|
|
153
|
+
// Parks and recreation
|
|
154
|
+
| 'amusementPark'
|
|
155
|
+
| 'aquarium'
|
|
156
|
+
| 'beach'
|
|
157
|
+
| 'campground'
|
|
158
|
+
| 'fairground'
|
|
159
|
+
| 'marina'
|
|
160
|
+
| 'nationalPark'
|
|
161
|
+
| 'park'
|
|
162
|
+
| 'rvPark'
|
|
163
|
+
| 'zoo'
|
|
164
|
+
// Sports
|
|
165
|
+
| 'baseball'
|
|
166
|
+
| 'basketball'
|
|
167
|
+
| 'bowling'
|
|
168
|
+
| 'goKart'
|
|
169
|
+
| 'golf'
|
|
170
|
+
| 'hiking'
|
|
171
|
+
| 'miniGolf'
|
|
172
|
+
| 'rockClimbing'
|
|
173
|
+
| 'skatePark'
|
|
174
|
+
| 'skating'
|
|
175
|
+
| 'skiing'
|
|
176
|
+
| 'soccer'
|
|
177
|
+
| 'stadium'
|
|
178
|
+
| 'tennis'
|
|
179
|
+
| 'volleyball'
|
|
180
|
+
// Travel
|
|
181
|
+
| 'airport'
|
|
182
|
+
| 'carRental'
|
|
183
|
+
| 'conventionCenter'
|
|
184
|
+
| 'gasStation'
|
|
185
|
+
| 'hotel'
|
|
186
|
+
| 'parking'
|
|
187
|
+
| 'publicTransport'
|
|
188
|
+
// Water sports
|
|
189
|
+
| 'fishing'
|
|
190
|
+
| 'kayaking'
|
|
191
|
+
| 'surfing'
|
|
192
|
+
| 'swimming';
|
|
@@ -728,16 +728,6 @@ export interface MapFabricNativeProps extends ViewProps {
|
|
|
728
728
|
*/
|
|
729
729
|
showsMyLocationButton?: boolean;
|
|
730
730
|
|
|
731
|
-
/**
|
|
732
|
-
* If `false` points of interest won't be displayed on the map.
|
|
733
|
-
* TODO: DEPRECATED? Doesn't seem to do anything
|
|
734
|
-
*
|
|
735
|
-
* @default true
|
|
736
|
-
* @platform iOS: Maybe Apple Maps?
|
|
737
|
-
* @platform Android: Not supported
|
|
738
|
-
*/
|
|
739
|
-
showsPointsOfInterest?: boolean;
|
|
740
|
-
|
|
741
731
|
/**
|
|
742
732
|
* A Boolean indicating whether the map shows scale information.
|
|
743
733
|
*
|
|
@@ -869,6 +869,25 @@ export interface MapFabricNativeProps extends ViewProps {
|
|
|
869
869
|
*/
|
|
870
870
|
showsIndoors?: WithDefault<boolean, true>;
|
|
871
871
|
|
|
872
|
+
/**
|
|
873
|
+
* A Boolean indicating whether points of interest should be displayed.
|
|
874
|
+
* Use `pointsOfInterestFilter` for more granular control.
|
|
875
|
+
*
|
|
876
|
+
* @default true
|
|
877
|
+
* @platform iOS: Apple Maps
|
|
878
|
+
* @platform Android: Not supported
|
|
879
|
+
*/
|
|
880
|
+
showsPointsOfInterests?: WithDefault<boolean, true>;
|
|
881
|
+
|
|
882
|
+
/**
|
|
883
|
+
* An array of category strings to show on the map.
|
|
884
|
+
* If this is set, it takes precedence over `showsPointsOfInterests`.
|
|
885
|
+
*
|
|
886
|
+
* @platform iOS: Apple Maps
|
|
887
|
+
* @platform Android: Not supported
|
|
888
|
+
*/
|
|
889
|
+
pointsOfInterestFilter?: ReadonlyArray<string>;
|
|
890
|
+
|
|
872
891
|
/**
|
|
873
892
|
* If `false` hide the button to move map to the current user's location.
|
|
874
893
|
*
|