react-native-maps 1.25.6 → 1.26.1

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.
Files changed (53) hide show
  1. package/README.md +13 -11
  2. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  3. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +2 -1
  4. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +2 -1
  5. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +2 -1
  6. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +7 -1
  7. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +5 -1
  8. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +1 -1
  9. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +2 -1
  10. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +2 -1
  11. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +2 -1
  12. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerInterface.java +2 -1
  13. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerInterface.java +2 -1
  14. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +11 -0
  15. package/android/src/main/jni/CMakeLists.txt +1 -9
  16. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +517 -517
  17. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +810 -21
  18. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +666 -1
  19. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +12 -111
  20. package/ios/AirMaps/AIRMap.h +2 -0
  21. package/ios/AirMaps/AIRMap.mm +181 -0
  22. package/ios/AirMaps/RNMapsMapView.mm +8 -0
  23. package/ios/generated/RCTAppDependencyProvider.mm +13 -28
  24. package/ios/generated/RCTModuleProviders.h +16 -0
  25. package/ios/generated/RCTModuleProviders.mm +51 -0
  26. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +30 -9
  27. package/ios/generated/RCTThirdPartyComponentsProvider.mm +9 -2
  28. package/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.h +14 -0
  29. package/ios/generated/RCTUnstableModulesRequiringMainQueueSetupProvider.mm +19 -0
  30. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +517 -517
  31. package/ios/generated/RNMapsSpecs/Props.cpp +811 -22
  32. package/ios/generated/RNMapsSpecs/Props.h +667 -2
  33. package/ios/generated/RNMapsSpecs/States.h +12 -111
  34. package/ios/generated/ReactAppDependencyProvider.podspec +1 -1
  35. package/ios/generated/ReactCodegen.podspec +120 -0
  36. package/package.json +14 -14
  37. package/plugin/build/android.js +2 -2
  38. package/plugin/build/ios.js +8 -8
  39. package/react-native-maps.podspec +4 -0
  40. package/src/MapMarkerNativeComponent.ts +1 -1
  41. package/src/MapView.tsx +17 -0
  42. package/src/MapViewNativeComponent.ts +1 -1
  43. package/src/sharedTypes.ts +91 -0
  44. package/src/specs/NativeComponentCallout.ts +1 -1
  45. package/src/specs/NativeComponentCircle.ts +1 -1
  46. package/src/specs/NativeComponentGoogleMapView.ts +1 -12
  47. package/src/specs/NativeComponentGooglePolygon.ts +1 -1
  48. package/src/specs/NativeComponentMapView.ts +20 -2
  49. package/src/specs/NativeComponentMarker.ts +1 -2
  50. package/src/specs/NativeComponentOverlay.ts +1 -1
  51. package/src/specs/NativeComponentPolyline.ts +1 -1
  52. package/src/specs/NativeComponentUrlTile.ts +1 -1
  53. package/src/specs/NativeComponentWMSTile.ts +1 -1
@@ -8,130 +8,31 @@
8
8
  */
9
9
  #pragma once
10
10
 
11
- #ifdef ANDROID
11
+ #include <react/renderer/core/StateData.h>
12
+ #ifdef RN_SERIALIZABLE_STATE
12
13
  #include <folly/dynamic.h>
13
14
  #endif
14
15
 
15
16
  namespace facebook::react {
16
17
 
17
- class RNMapsCalloutState {
18
- public:
19
- RNMapsCalloutState() = default;
18
+ using RNMapsCalloutState = StateData;
20
19
 
21
- #ifdef ANDROID
22
- RNMapsCalloutState(RNMapsCalloutState const &previousState, folly::dynamic data){};
23
- folly::dynamic getDynamic() const {
24
- return {};
25
- };
26
- #endif
27
- };
28
-
29
- class RNMapsCircleState {
30
- public:
31
- RNMapsCircleState() = default;
32
-
33
- #ifdef ANDROID
34
- RNMapsCircleState(RNMapsCircleState const &previousState, folly::dynamic data){};
35
- folly::dynamic getDynamic() const {
36
- return {};
37
- };
38
- #endif
39
- };
40
-
41
- class RNMapsGoogleMapViewState {
42
- public:
43
- RNMapsGoogleMapViewState() = default;
44
-
45
- #ifdef ANDROID
46
- RNMapsGoogleMapViewState(RNMapsGoogleMapViewState const &previousState, folly::dynamic data){};
47
- folly::dynamic getDynamic() const {
48
- return {};
49
- };
50
- #endif
51
- };
52
-
53
- class RNMapsGooglePolygonState {
54
- public:
55
- RNMapsGooglePolygonState() = default;
56
-
57
- #ifdef ANDROID
58
- RNMapsGooglePolygonState(RNMapsGooglePolygonState const &previousState, folly::dynamic data){};
59
- folly::dynamic getDynamic() const {
60
- return {};
61
- };
62
- #endif
63
- };
20
+ using RNMapsCircleState = StateData;
64
21
 
65
- class RNMapsMapViewState {
66
- public:
67
- RNMapsMapViewState() = default;
22
+ using RNMapsGoogleMapViewState = StateData;
68
23
 
69
- #ifdef ANDROID
70
- RNMapsMapViewState(RNMapsMapViewState const &previousState, folly::dynamic data){};
71
- folly::dynamic getDynamic() const {
72
- return {};
73
- };
74
- #endif
75
- };
76
-
77
- class RNMapsMarkerState {
78
- public:
79
- RNMapsMarkerState() = default;
80
-
81
- #ifdef ANDROID
82
- RNMapsMarkerState(RNMapsMarkerState const &previousState, folly::dynamic data){};
83
- folly::dynamic getDynamic() const {
84
- return {};
85
- };
86
- #endif
87
- };
88
-
89
- class RNMapsOverlayState {
90
- public:
91
- RNMapsOverlayState() = default;
24
+ using RNMapsGooglePolygonState = StateData;
92
25
 
93
- #ifdef ANDROID
94
- RNMapsOverlayState(RNMapsOverlayState const &previousState, folly::dynamic data){};
95
- folly::dynamic getDynamic() const {
96
- return {};
97
- };
98
- #endif
99
- };
26
+ using RNMapsMapViewState = StateData;
100
27
 
101
- class RNMapsPolylineState {
102
- public:
103
- RNMapsPolylineState() = default;
28
+ using RNMapsMarkerState = StateData;
104
29
 
105
- #ifdef ANDROID
106
- RNMapsPolylineState(RNMapsPolylineState const &previousState, folly::dynamic data){};
107
- folly::dynamic getDynamic() const {
108
- return {};
109
- };
110
- #endif
111
- };
30
+ using RNMapsOverlayState = StateData;
112
31
 
113
- class RNMapsUrlTileState {
114
- public:
115
- RNMapsUrlTileState() = default;
32
+ using RNMapsPolylineState = StateData;
116
33
 
117
- #ifdef ANDROID
118
- RNMapsUrlTileState(RNMapsUrlTileState const &previousState, folly::dynamic data){};
119
- folly::dynamic getDynamic() const {
120
- return {};
121
- };
122
- #endif
123
- };
34
+ using RNMapsUrlTileState = StateData;
124
35
 
125
- class RNMapsWMSTileState {
126
- public:
127
- RNMapsWMSTileState() = default;
128
-
129
- #ifdef ANDROID
130
- RNMapsWMSTileState(RNMapsWMSTileState const &previousState, folly::dynamic data){};
131
- folly::dynamic getDynamic() const {
132
- return {};
133
- };
134
- #endif
135
- };
36
+ using RNMapsWMSTileState = StateData;
136
37
 
137
38
  } // namespace facebook::react
@@ -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;
@@ -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
  }
@@ -8,48 +8,33 @@
8
8
  #import "RCTAppDependencyProvider.h"
9
9
  #import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
10
10
  #import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
11
+ #import <ReactCodegen/RCTUnstableModulesRequiringMainQueueSetupProvider.h>
12
+ #import <ReactCodegen/RCTModuleProviders.h>
11
13
 
12
- @implementation RCTAppDependencyProvider {
13
- NSArray<NSString *> * _URLRequestHandlerClassNames;
14
- NSArray<NSString *> * _imageDataDecoderClassNames;
15
- NSArray<NSString *> * _imageURLLoaderClassNames;
16
- NSDictionary<NSString *,Class<RCTComponentViewProtocol>> * _thirdPartyFabricComponents;
17
- }
14
+ @implementation RCTAppDependencyProvider
18
15
 
19
16
  - (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
20
- static dispatch_once_t requestUrlToken;
21
- dispatch_once(&requestUrlToken, ^{
22
- self->_URLRequestHandlerClassNames = RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
23
- });
24
-
25
- return _URLRequestHandlerClassNames;
17
+ return RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
26
18
  }
27
19
 
28
20
  - (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
29
- static dispatch_once_t dataDecoderToken;
30
- dispatch_once(&dataDecoderToken, ^{
31
- _imageDataDecoderClassNames = RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
32
- });
33
-
34
- return _imageDataDecoderClassNames;
21
+ return RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
35
22
  }
36
23
 
37
24
  - (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
38
- static dispatch_once_t urlLoaderToken;
39
- dispatch_once(&urlLoaderToken, ^{
40
- _imageURLLoaderClassNames = RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
41
- });
25
+ return RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
26
+ }
42
27
 
43
- return _imageURLLoaderClassNames;
28
+ - (nonnull NSArray<NSString *> *)unstableModulesRequiringMainQueueSetup {
29
+ return RCTUnstableModulesRequiringMainQueueSetupProvider.modules;
44
30
  }
45
31
 
46
32
  - (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
47
- static dispatch_once_t nativeComponentsToken;
48
- dispatch_once(&nativeComponentsToken, ^{
49
- _thirdPartyFabricComponents = RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
50
- });
33
+ return RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
34
+ }
51
35
 
52
- return _thirdPartyFabricComponents;
36
+ - (nonnull NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders {
37
+ return RCTModuleProviders.moduleProviders;
53
38
  }
54
39
 
55
40
  @end
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ @protocol RCTModuleProvider;
11
+
12
+ @interface RCTModuleProviders: NSObject
13
+
14
+ + (NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders;
15
+
16
+ @end
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ #import "RCTModuleProviders.h"
11
+ #import <ReactCommon/RCTTurboModule.h>
12
+ #import <React/RCTLog.h>
13
+
14
+ @implementation RCTModuleProviders
15
+
16
+ + (NSDictionary<NSString *, id<RCTModuleProvider>> *)moduleProviders
17
+ {
18
+ static NSDictionary<NSString *, id<RCTModuleProvider>> *providers = nil;
19
+ static dispatch_once_t onceToken;
20
+
21
+ dispatch_once(&onceToken, ^{
22
+ NSDictionary<NSString *, NSString *> * moduleMapping = @{
23
+
24
+ };
25
+
26
+ NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithCapacity:moduleMapping.count];
27
+
28
+ for (NSString *key in moduleMapping) {
29
+ NSString * moduleProviderName = moduleMapping[key];
30
+ Class klass = NSClassFromString(moduleProviderName);
31
+ if (!klass) {
32
+ RCTLogError(@"Module provider %@ cannot be found in the runtime", moduleProviderName);
33
+ continue;
34
+ }
35
+
36
+ id instance = [klass new];
37
+ if (![instance respondsToSelector:@selector(getTurboModule:)]) {
38
+ RCTLogError(@"Module provider %@ does not conform to RCTModuleProvider", moduleProviderName);
39
+ continue;
40
+ }
41
+
42
+ [dict setObject:instance forKey:key];
43
+ }
44
+
45
+ providers = dict;
46
+ });
47
+
48
+ return providers;
49
+ }
50
+
51
+ @end
@@ -11,23 +11,44 @@
11
11
 
12
12
  +(NSArray<NSString *> *)imageURLLoaderClassNames
13
13
  {
14
- return @[
15
-
16
- ];
14
+ static NSArray<NSString *> *classNames = nil;
15
+ static dispatch_once_t onceToken;
16
+
17
+ dispatch_once(&onceToken, ^{
18
+ classNames = @[
19
+
20
+ ];
21
+ });
22
+
23
+ return classNames;
17
24
  }
18
25
 
19
26
  +(NSArray<NSString *> *)imageDataDecoderClassNames
20
27
  {
21
- return @[
22
-
23
- ];
28
+ static NSArray<NSString *> *classNames = nil;
29
+ static dispatch_once_t onceToken;
30
+
31
+ dispatch_once(&onceToken, ^{
32
+ classNames = @[
33
+
34
+ ];
35
+ });
36
+
37
+ return classNames;
24
38
  }
25
39
 
26
40
  +(NSArray<NSString *> *)URLRequestHandlerClassNames
27
41
  {
28
- return @[
29
-
30
- ];
42
+ static NSArray<NSString *> *classNames = nil;
43
+ static dispatch_once_t onceToken;
44
+
45
+ dispatch_once(&onceToken, ^{
46
+ classNames = @[
47
+
48
+ ];
49
+ });
50
+
51
+ return classNames;
31
52
  }
32
53
 
33
54
  @end
@@ -15,12 +15,19 @@
15
15
 
16
16
  + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
17
17
  {
18
- return @{
18
+ static NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *thirdPartyComponents = nil;
19
+ static dispatch_once_t nativeComponentsToken;
20
+
21
+ dispatch_once(&nativeComponentsToken, ^{
22
+ thirdPartyComponents = @{
19
23
  @"RNMapsGoogleMapView": NSClassFromString(@"RNMapsGoogleMapView"), // react-native-maps
20
24
  @"RNMapsGooglePolygon": NSClassFromString(@"RNMapsGooglePolygonView"), // react-native-maps
21
25
  @"RNMapsMapView": NSClassFromString(@"RNMapsMapView"), // react-native-maps
22
26
  @"RNMapsMarker": NSClassFromString(@"RNMapsMarkerView"), // react-native-maps
23
- };
27
+ };
28
+ });
29
+
30
+ return thirdPartyComponents;
24
31
  }
25
32
 
26
33
  @end
@@ -0,0 +1,14 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ @interface RCTUnstableModulesRequiringMainQueueSetupProvider: NSObject
11
+
12
+ +(NSArray<NSString *> *)modules;
13
+
14
+ @end
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ #import "RCTUnstableModulesRequiringMainQueueSetupProvider.h"
9
+
10
+ @implementation RCTUnstableModulesRequiringMainQueueSetupProvider
11
+
12
+ +(NSArray<NSString *> *)modules
13
+ {
14
+ return @[
15
+
16
+ ];
17
+ }
18
+
19
+ @end