react-native-maps 1.21.0-alpha.138 → 1.21.0-alpha.140

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 (23) hide show
  1. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerDelegate.java +3 -3
  2. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerDelegate.java +56 -0
  3. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerInterface.java +25 -0
  4. package/android/src/main/java/com/rnmaps/fabric/WMSTileManager.java +114 -0
  5. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +6 -1
  6. package/android/src/main/java/com/rnmaps/maps/MapUrlTile.java +17 -17
  7. package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +10 -10
  8. package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +3 -3
  9. package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +10 -10
  10. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +1 -0
  11. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +1 -0
  12. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +1 -0
  13. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +7 -0
  14. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +18 -3
  15. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +21 -3
  16. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +1 -0
  17. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +11 -0
  18. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +12 -0
  19. package/package.json +1 -1
  20. package/src/MapWMSTile.tsx +1 -1
  21. package/src/decorateMapComponent.ts +4 -0
  22. package/src/specs/NativeComponentUrlTile.ts +4 -4
  23. package/src/specs/NativeComponentWMSTile.ts +107 -0
@@ -29,10 +29,10 @@ public class RNMapsUrlTileManagerDelegate<T extends View, U extends BaseViewMana
29
29
  mViewManager.setFlipY(view, value == null ? false : (boolean) value);
30
30
  break;
31
31
  case "maximumNativeZ":
32
- mViewManager.setMaximumNativeZ(view, value == null ? 0 : ((Double) value).intValue());
32
+ mViewManager.setMaximumNativeZ(view, value == null ? 100 : ((Double) value).intValue());
33
33
  break;
34
34
  case "maximumZ":
35
- mViewManager.setMaximumZ(view, value == null ? 0 : ((Double) value).intValue());
35
+ mViewManager.setMaximumZ(view, value == null ? 100 : ((Double) value).intValue());
36
36
  break;
37
37
  case "minimumZ":
38
38
  mViewManager.setMinimumZ(view, value == null ? 0 : ((Double) value).intValue());
@@ -50,7 +50,7 @@ public class RNMapsUrlTileManagerDelegate<T extends View, U extends BaseViewMana
50
50
  mViewManager.setTileCachePath(view, value == null ? null : (String) value);
51
51
  break;
52
52
  case "tileSize":
53
- mViewManager.setTileSize(view, value == null ? 0 : ((Double) value).intValue());
53
+ mViewManager.setTileSize(view, value == null ? 256 : ((Double) value).intValue());
54
54
  break;
55
55
  case "urlTemplate":
56
56
  mViewManager.setUrlTemplate(view, value == null ? null : (String) value);
@@ -0,0 +1,56 @@
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.uimanager.BaseViewManager;
15
+ import com.facebook.react.uimanager.BaseViewManagerDelegate;
16
+ import com.facebook.react.uimanager.LayoutShadowNode;
17
+
18
+ public class RNMapsWMSTileManagerDelegate<T extends View, U extends BaseViewManager<T, ? extends LayoutShadowNode> & RNMapsWMSTileManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
19
+ public RNMapsWMSTileManagerDelegate(U viewManager) {
20
+ super(viewManager);
21
+ }
22
+ @Override
23
+ public void setProperty(T view, String propName, @Nullable Object value) {
24
+ switch (propName) {
25
+ case "maximumNativeZ":
26
+ mViewManager.setMaximumNativeZ(view, value == null ? 100 : ((Double) value).intValue());
27
+ break;
28
+ case "maximumZ":
29
+ mViewManager.setMaximumZ(view, value == null ? 100 : ((Double) value).intValue());
30
+ break;
31
+ case "minimumZ":
32
+ mViewManager.setMinimumZ(view, value == null ? 0 : ((Double) value).intValue());
33
+ break;
34
+ case "offlineMode":
35
+ mViewManager.setOfflineMode(view, value == null ? false : (boolean) value);
36
+ break;
37
+ case "shouldReplaceMapContent":
38
+ mViewManager.setShouldReplaceMapContent(view, value == null ? false : (boolean) value);
39
+ break;
40
+ case "tileCacheMaxAge":
41
+ mViewManager.setTileCacheMaxAge(view, value == null ? 0 : ((Double) value).intValue());
42
+ break;
43
+ case "tileCachePath":
44
+ mViewManager.setTileCachePath(view, value == null ? null : (String) value);
45
+ break;
46
+ case "tileSize":
47
+ mViewManager.setTileSize(view, value == null ? 256 : ((Double) value).intValue());
48
+ break;
49
+ case "urlTemplate":
50
+ mViewManager.setUrlTemplate(view, value == null ? null : (String) value);
51
+ break;
52
+ default:
53
+ super.setProperty(view, propName, value);
54
+ }
55
+ }
56
+ }
@@ -0,0 +1,25 @@
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
+
15
+ public interface RNMapsWMSTileManagerInterface<T extends View> {
16
+ void setMaximumNativeZ(T view, int value);
17
+ void setMaximumZ(T view, int value);
18
+ void setMinimumZ(T view, int value);
19
+ void setOfflineMode(T view, boolean value);
20
+ void setShouldReplaceMapContent(T view, boolean value);
21
+ void setTileCacheMaxAge(T view, int value);
22
+ void setTileCachePath(T view, @Nullable String value);
23
+ void setTileSize(T view, int value);
24
+ void setUrlTemplate(T view, @Nullable String value);
25
+ }
@@ -0,0 +1,114 @@
1
+ package com.rnmaps.fabric;
2
+
3
+ import androidx.annotation.NonNull;
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.ThemedReactContext;
9
+ import com.facebook.react.uimanager.ViewGroupManager;
10
+ import com.facebook.react.uimanager.ViewManagerDelegate;
11
+ import com.facebook.react.viewmanagers.RNMapsWMSTileManagerDelegate;
12
+ import com.facebook.react.viewmanagers.RNMapsWMSTileManagerInterface;
13
+ import com.rnmaps.maps.MapWMSTile;
14
+
15
+ import java.util.HashMap;
16
+ import java.util.Map;
17
+
18
+ @ReactModule(name = WMSTileManager.REACT_CLASS)
19
+ public class WMSTileManager extends ViewGroupManager<MapWMSTile> implements RNMapsWMSTileManagerInterface<MapWMSTile> {
20
+ public static final String REACT_CLASS = "RNMapsWMSTile";
21
+
22
+ public WMSTileManager(ReactApplicationContext context) {
23
+ super(context);
24
+ }
25
+
26
+ private final RNMapsWMSTileManagerDelegate<MapWMSTile, WMSTileManager> delegate =
27
+ new RNMapsWMSTileManagerDelegate<>(this);
28
+
29
+ @Override
30
+ public ViewManagerDelegate<MapWMSTile> getDelegate() {
31
+ return delegate;
32
+ }
33
+
34
+ @Override
35
+ public String getName() {
36
+ return REACT_CLASS;
37
+ }
38
+
39
+ @Override
40
+ public MapWMSTile createViewInstance(ThemedReactContext context) {
41
+ return new MapWMSTile(context);
42
+ }
43
+
44
+
45
+ @Nullable
46
+ @Override
47
+ public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
48
+ return new HashMap<>();
49
+ }
50
+
51
+ @Nullable
52
+ @Override
53
+ public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
54
+ return new HashMap<>();
55
+ }
56
+
57
+ @Override
58
+ public void setMaximumNativeZ(MapWMSTile view, int value) {
59
+ view.setMaximumNativeZ(value);
60
+ }
61
+
62
+ @Override
63
+ public void setMaximumZ(MapWMSTile view, int value) {
64
+ view.setMaximumZ(value);
65
+ }
66
+
67
+ @Override
68
+ public void setMinimumZ(MapWMSTile view, int value) {
69
+ view.setMinimumZ(value);
70
+ }
71
+
72
+ @Override
73
+ public void setOfflineMode(MapWMSTile view, boolean value) {
74
+ view.setOfflineMode(value);
75
+ }
76
+
77
+ @Override
78
+ public void setShouldReplaceMapContent(MapWMSTile view, boolean value) {
79
+ // not supported
80
+ }
81
+
82
+ @Override
83
+ public void setZIndex(@NonNull MapWMSTile view, float zIndex) {
84
+ super.setZIndex(view, zIndex);
85
+ view.setZIndex(zIndex);
86
+ }
87
+
88
+ @Override
89
+ public void setOpacity(@NonNull MapWMSTile view, float opacity) {
90
+ super.setOpacity(view, opacity);
91
+ view.setOpacity(opacity);
92
+ }
93
+
94
+ @Override
95
+ public void setTileCacheMaxAge(MapWMSTile view, int value) {
96
+ view.setTileCacheMaxAge(value);
97
+ }
98
+
99
+ @Override
100
+ public void setTileCachePath(MapWMSTile view, @Nullable String value) {
101
+ view.setTileCachePath(value);
102
+ }
103
+
104
+ @Override
105
+ public void setTileSize(MapWMSTile view, int value) {
106
+ view.setTileSize(value);
107
+ }
108
+
109
+ @Override
110
+ public void setUrlTemplate(MapWMSTile view, @Nullable String value) {
111
+ view.setUrlTemplate(value);
112
+ }
113
+
114
+ }
@@ -18,6 +18,7 @@ import com.rnmaps.fabric.OverlayManager;
18
18
  import com.rnmaps.fabric.PolygonManager;
19
19
  import com.rnmaps.fabric.PolylineManager;
20
20
  import com.rnmaps.fabric.UrlTileManager;
21
+ import com.rnmaps.fabric.WMSTileManager;
21
22
 
22
23
  import java.util.HashMap;
23
24
  import java.util.List;
@@ -34,7 +35,8 @@ public class MapAirModulePackage extends TurboReactPackage {
34
35
  new PolylineManager(reactContext),
35
36
  new CircleManager(reactContext),
36
37
  new OverlayManager(reactContext),
37
- new UrlTileManager(reactContext));
38
+ new UrlTileManager(reactContext),
39
+ new WMSTileManager(reactContext));
38
40
  }
39
41
 
40
42
 
@@ -64,6 +66,9 @@ public class MapAirModulePackage extends TurboReactPackage {
64
66
  if (UrlTileManager.REACT_CLASS.equals(name)) {
65
67
  return new UrlTileManager(reactContext);
66
68
  }
69
+ if (WMSTileManager.REACT_CLASS.equals(name)) {
70
+ return new WMSTileManager(reactContext);
71
+ }
67
72
  if (NativeAirMapsModuleSpec.NAME.equals(name)) {
68
73
  return new NativeAirMapsModule(reactContext);
69
74
  } else {
@@ -18,14 +18,14 @@ public class MapUrlTile extends MapFeature {
18
18
 
19
19
  protected String urlTemplate;
20
20
  protected float zIndex;
21
- protected float maximumZ;
22
- protected float maximumNativeZ = 100;
23
- protected float minimumZ;
21
+ protected int maximumZ;
22
+ protected int maximumNativeZ = 100;
23
+ protected int minimumZ;
24
24
  protected boolean flipY = false;
25
- protected float tileSize = 256;
25
+ protected int tileSize = 256;
26
26
  protected boolean doubleTileSize = false;
27
27
  protected String tileCachePath;
28
- protected float tileCacheMaxAge;
28
+ protected int tileCacheMaxAge;
29
29
  protected boolean offlineMode = false;
30
30
  protected float opacity = 1;
31
31
  protected Context context;
@@ -53,20 +53,20 @@ public class MapUrlTile extends MapFeature {
53
53
  }
54
54
  }
55
55
 
56
- public void setMaximumZ(float maximumZ) {
56
+ public void setMaximumZ(int maximumZ) {
57
57
  this.maximumZ = maximumZ;
58
58
  if (tileProvider != null) {
59
- tileProvider.setMaximumZ((int)maximumZ);
59
+ tileProvider.setMaximumZ(maximumZ);
60
60
  }
61
61
  if (tileOverlay != null) {
62
62
  tileOverlay.clearTileCache();
63
63
  }
64
64
  }
65
65
 
66
- public void setMaximumNativeZ(float maximumNativeZ) {
66
+ public void setMaximumNativeZ(int maximumNativeZ) {
67
67
  this.maximumNativeZ = maximumNativeZ;
68
68
  if (tileProvider != null) {
69
- tileProvider.setMaximumNativeZ((int)maximumNativeZ);
69
+ tileProvider.setMaximumNativeZ(maximumNativeZ);
70
70
  }
71
71
  setCustomTileProviderMode();
72
72
  if (tileOverlay != null) {
@@ -74,10 +74,10 @@ public class MapUrlTile extends MapFeature {
74
74
  }
75
75
  }
76
76
 
77
- public void setMinimumZ(float minimumZ) {
77
+ public void setMinimumZ(int minimumZ) {
78
78
  this.minimumZ = minimumZ;
79
79
  if (tileProvider != null) {
80
- tileProvider.setMinimumZ((int)minimumZ);
80
+ tileProvider.setMinimumZ(minimumZ);
81
81
  }
82
82
  if (tileOverlay != null) {
83
83
  tileOverlay.clearTileCache();
@@ -105,10 +105,10 @@ public class MapUrlTile extends MapFeature {
105
105
  }
106
106
  }
107
107
 
108
- public void setTileSize(float tileSize) {
108
+ public void setTileSize(int tileSize) {
109
109
  this.tileSize = tileSize;
110
110
  if (tileProvider != null) {
111
- tileProvider.setTileSize((int)tileSize);
111
+ tileProvider.setTileSize(tileSize);
112
112
  }
113
113
  if (tileOverlay != null) {
114
114
  tileOverlay.clearTileCache();
@@ -136,10 +136,10 @@ public class MapUrlTile extends MapFeature {
136
136
  }
137
137
  }
138
138
 
139
- public void setTileCacheMaxAge(float tileCacheMaxAge) {
139
+ public void setTileCacheMaxAge(int tileCacheMaxAge) {
140
140
  this.tileCacheMaxAge = tileCacheMaxAge;
141
141
  if (tileProvider != null) {
142
- tileProvider.setTileCacheMaxAge((int)tileCacheMaxAge);
142
+ tileProvider.setTileCacheMaxAge(tileCacheMaxAge);
143
143
  }
144
144
  if (tileOverlay != null) {
145
145
  tileOverlay.clearTileCache();
@@ -184,8 +184,8 @@ public class MapUrlTile extends MapFeature {
184
184
  options.zIndex(zIndex);
185
185
  options.transparency(1 - this.opacity);
186
186
  this.tileProvider = new MapTileProvider((int)this.tileSize, this.doubleTileSize, this.urlTemplate,
187
- (int)this.maximumZ, (int)this.maximumNativeZ, (int)this.minimumZ, this.flipY, this.tileCachePath,
188
- (int)this.tileCacheMaxAge, this.offlineMode, this.context, this.customTileProviderNeeded);
187
+ this.maximumZ, this.maximumNativeZ, this.minimumZ, this.flipY, this.tileCachePath,
188
+ this.tileCacheMaxAge, this.offlineMode, this.context, this.customTileProviderNeeded);
189
189
  options.tileProvider(this.tileProvider);
190
190
  return options;
191
191
  }
@@ -35,18 +35,18 @@ public class MapUrlTileManager extends ViewGroupManager<MapUrlTile> {
35
35
  view.setZIndex(zIndex);
36
36
  }
37
37
 
38
- @ReactProp(name = "minimumZ", defaultFloat = 0.0f)
39
- public void setMinimumZ(MapUrlTile view, float minimumZ) {
38
+ @ReactProp(name = "minimumZ", defaultInt = 0)
39
+ public void setMinimumZ(MapUrlTile view, int minimumZ) {
40
40
  view.setMinimumZ(minimumZ);
41
41
  }
42
42
 
43
- @ReactProp(name = "maximumZ", defaultFloat = 100.0f)
44
- public void setMaximumZ(MapUrlTile view, float maximumZ) {
43
+ @ReactProp(name = "maximumZ", defaultInt = 100)
44
+ public void setMaximumZ(MapUrlTile view, int maximumZ) {
45
45
  view.setMaximumZ(maximumZ);
46
46
  }
47
47
 
48
- @ReactProp(name = "maximumNativeZ", defaultFloat = 100.0f)
49
- public void setMaximumNativeZ(MapUrlTile view, float maximumNativeZ) {
48
+ @ReactProp(name = "maximumNativeZ", defaultInt = 100)
49
+ public void setMaximumNativeZ(MapUrlTile view, int maximumNativeZ) {
50
50
  view.setMaximumNativeZ(maximumNativeZ);
51
51
  }
52
52
 
@@ -55,8 +55,8 @@ public class MapUrlTileManager extends ViewGroupManager<MapUrlTile> {
55
55
  view.setFlipY(flipY);
56
56
  }
57
57
 
58
- @ReactProp(name = "tileSize", defaultFloat = 256.0f)
59
- public void setTileSize(MapUrlTile view, float tileSize) {
58
+ @ReactProp(name = "tileSize", defaultInt = 256)
59
+ public void setTileSize(MapUrlTile view, int tileSize) {
60
60
  view.setTileSize(tileSize);
61
61
  }
62
62
 
@@ -70,8 +70,8 @@ public class MapUrlTileManager extends ViewGroupManager<MapUrlTile> {
70
70
  view.setTileCachePath(tileCachePath);
71
71
  }
72
72
 
73
- @ReactProp(name = "tileCacheMaxAge", defaultFloat = 0.0f)
74
- public void setTileCacheMaxAge(MapUrlTile view, float tileCacheMaxAge) {
73
+ @ReactProp(name = "tileCacheMaxAge", defaultInt = 0)
74
+ public void setTileCacheMaxAge(MapUrlTile view, int tileCacheMaxAge) {
75
75
  view.setTileCacheMaxAge(tileCacheMaxAge);
76
76
  }
77
77
 
@@ -85,9 +85,9 @@ public class MapWMSTile extends MapUrlTile {
85
85
  TileOverlayOptions options = new TileOverlayOptions();
86
86
  options.zIndex(zIndex);
87
87
  options.transparency(1 - this.opacity);
88
- AIRMapGSUrlTileProvider tileProvider = new AIRMapGSUrlTileProvider((int) this.tileSize, this.urlTemplate,
89
- (int) this.maximumZ, (int) this.maximumNativeZ, (int) this.minimumZ, this.tileCachePath,
90
- (int) this.tileCacheMaxAge, this.offlineMode, this.context, this.customTileProviderNeeded);
88
+ AIRMapGSUrlTileProvider tileProvider = new AIRMapGSUrlTileProvider(this.tileSize, this.urlTemplate,
89
+ this.maximumZ, this.maximumNativeZ, this.minimumZ, this.tileCachePath,
90
+ this.tileCacheMaxAge, this.offlineMode, this.context, this.customTileProviderNeeded);
91
91
  options.tileProvider(tileProvider);
92
92
  return options;
93
93
  }
@@ -39,23 +39,23 @@ public class MapWMSTileManager extends ViewGroupManager<MapWMSTile> {
39
39
  view.setZIndex(zIndex);
40
40
  }
41
41
 
42
- @ReactProp(name = "minimumZ", defaultFloat = 0.0f)
43
- public void setMinimumZ(MapWMSTile view, float minimumZ) {
42
+ @ReactProp(name = "minimumZ", defaultInt = 0)
43
+ public void setMinimumZ(MapWMSTile view, int minimumZ) {
44
44
  view.setMinimumZ(minimumZ);
45
45
  }
46
46
 
47
- @ReactProp(name = "maximumZ", defaultFloat = 100.0f)
48
- public void setMaximumZ(MapWMSTile view, float maximumZ) {
47
+ @ReactProp(name = "maximumZ", defaultInt = 100)
48
+ public void setMaximumZ(MapWMSTile view, int maximumZ) {
49
49
  view.setMaximumZ(maximumZ);
50
50
  }
51
51
 
52
- @ReactProp(name = "maximumNativeZ", defaultFloat = 100.0f)
53
- public void setMaximumNativeZ(MapWMSTile view, float maximumNativeZ) {
52
+ @ReactProp(name = "maximumNativeZ", defaultInt= 100)
53
+ public void setMaximumNativeZ(MapWMSTile view, int maximumNativeZ) {
54
54
  view.setMaximumNativeZ(maximumNativeZ);
55
55
  }
56
56
 
57
- @ReactProp(name = "tileSize", defaultFloat = 256.0f)
58
- public void setTileSize(MapWMSTile view, float tileSize) {
57
+ @ReactProp(name = "tileSize", defaultInt = 256)
58
+ public void setTileSize(MapWMSTile view, int tileSize) {
59
59
  view.setTileSize(tileSize);
60
60
  }
61
61
 
@@ -64,8 +64,8 @@ public class MapWMSTileManager extends ViewGroupManager<MapWMSTile> {
64
64
  view.setTileCachePath(tileCachePath);
65
65
  }
66
66
 
67
- @ReactProp(name = "tileCacheMaxAge", defaultFloat = 0.0f)
68
- public void setTileCacheMaxAge(MapWMSTile view, float tileCacheMaxAge) {
67
+ @ReactProp(name = "tileCacheMaxAge", defaultInt = 0)
68
+ public void setTileCacheMaxAge(MapWMSTile view, int tileCacheMaxAge) {
69
69
  view.setTileCacheMaxAge(tileCacheMaxAge);
70
70
  }
71
71
 
@@ -25,6 +25,7 @@ registry->add(concreteComponentDescriptorProvider<RNMapsMarkerComponentDescripto
25
25
  registry->add(concreteComponentDescriptorProvider<RNMapsOverlayComponentDescriptor>());
26
26
  registry->add(concreteComponentDescriptorProvider<RNMapsPolylineComponentDescriptor>());
27
27
  registry->add(concreteComponentDescriptorProvider<RNMapsUrlTileComponentDescriptor>());
28
+ registry->add(concreteComponentDescriptorProvider<RNMapsWMSTileComponentDescriptor>());
28
29
  }
29
30
 
30
31
  } // namespace facebook::react
@@ -25,6 +25,7 @@ using RNMapsMarkerComponentDescriptor = ConcreteComponentDescriptor<RNMapsMarker
25
25
  using RNMapsOverlayComponentDescriptor = ConcreteComponentDescriptor<RNMapsOverlayShadowNode>;
26
26
  using RNMapsPolylineComponentDescriptor = ConcreteComponentDescriptor<RNMapsPolylineShadowNode>;
27
27
  using RNMapsUrlTileComponentDescriptor = ConcreteComponentDescriptor<RNMapsUrlTileShadowNode>;
28
+ using RNMapsWMSTileComponentDescriptor = ConcreteComponentDescriptor<RNMapsWMSTileShadowNode>;
28
29
 
29
30
  void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
30
31
  std::shared_ptr<const ComponentDescriptorProviderRegistry> registry);
@@ -975,4 +975,5 @@ $payload.setProperty(runtime, "id", $event.id);
975
975
  }
976
976
 
977
977
 
978
+
978
979
  } // namespace facebook::react
@@ -849,5 +849,12 @@ class RNMapsUrlTileEventEmitter : public ViewEventEmitter {
849
849
 
850
850
 
851
851
 
852
+ };
853
+ class RNMapsWMSTileEventEmitter : public ViewEventEmitter {
854
+ public:
855
+ using ViewEventEmitter::ViewEventEmitter;
856
+
857
+
858
+
852
859
  };
853
860
  } // namespace facebook::react
@@ -198,14 +198,29 @@ RNMapsUrlTileProps::RNMapsUrlTileProps(
198
198
 
199
199
  doubleTileSize(convertRawProp(context, rawProps, "doubleTileSize", sourceProps.doubleTileSize, {false})),
200
200
  flipY(convertRawProp(context, rawProps, "flipY", sourceProps.flipY, {false})),
201
- maximumNativeZ(convertRawProp(context, rawProps, "maximumNativeZ", sourceProps.maximumNativeZ, {0})),
202
- maximumZ(convertRawProp(context, rawProps, "maximumZ", sourceProps.maximumZ, {0})),
201
+ maximumNativeZ(convertRawProp(context, rawProps, "maximumNativeZ", sourceProps.maximumNativeZ, {100})),
202
+ maximumZ(convertRawProp(context, rawProps, "maximumZ", sourceProps.maximumZ, {100})),
203
203
  minimumZ(convertRawProp(context, rawProps, "minimumZ", sourceProps.minimumZ, {0})),
204
204
  offlineMode(convertRawProp(context, rawProps, "offlineMode", sourceProps.offlineMode, {false})),
205
205
  shouldReplaceMapContent(convertRawProp(context, rawProps, "shouldReplaceMapContent", sourceProps.shouldReplaceMapContent, {false})),
206
206
  tileCacheMaxAge(convertRawProp(context, rawProps, "tileCacheMaxAge", sourceProps.tileCacheMaxAge, {0})),
207
207
  tileCachePath(convertRawProp(context, rawProps, "tileCachePath", sourceProps.tileCachePath, {})),
208
- tileSize(convertRawProp(context, rawProps, "tileSize", sourceProps.tileSize, {0})),
208
+ tileSize(convertRawProp(context, rawProps, "tileSize", sourceProps.tileSize, {256})),
209
+ urlTemplate(convertRawProp(context, rawProps, "urlTemplate", sourceProps.urlTemplate, {}))
210
+ {}
211
+ RNMapsWMSTileProps::RNMapsWMSTileProps(
212
+ const PropsParserContext &context,
213
+ const RNMapsWMSTileProps &sourceProps,
214
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
215
+
216
+ maximumNativeZ(convertRawProp(context, rawProps, "maximumNativeZ", sourceProps.maximumNativeZ, {100})),
217
+ maximumZ(convertRawProp(context, rawProps, "maximumZ", sourceProps.maximumZ, {100})),
218
+ minimumZ(convertRawProp(context, rawProps, "minimumZ", sourceProps.minimumZ, {0})),
219
+ offlineMode(convertRawProp(context, rawProps, "offlineMode", sourceProps.offlineMode, {false})),
220
+ shouldReplaceMapContent(convertRawProp(context, rawProps, "shouldReplaceMapContent", sourceProps.shouldReplaceMapContent, {false})),
221
+ tileCacheMaxAge(convertRawProp(context, rawProps, "tileCacheMaxAge", sourceProps.tileCacheMaxAge, {0})),
222
+ tileCachePath(convertRawProp(context, rawProps, "tileCachePath", sourceProps.tileCachePath, {})),
223
+ tileSize(convertRawProp(context, rawProps, "tileSize", sourceProps.tileSize, {256})),
209
224
  urlTemplate(convertRawProp(context, rawProps, "urlTemplate", sourceProps.urlTemplate, {}))
210
225
  {}
211
226
 
@@ -1231,14 +1231,32 @@ class RNMapsUrlTileProps final : public ViewProps {
1231
1231
 
1232
1232
  bool doubleTileSize{false};
1233
1233
  bool flipY{false};
1234
- int maximumNativeZ{0};
1235
- int maximumZ{0};
1234
+ int maximumNativeZ{100};
1235
+ int maximumZ{100};
1236
1236
  int minimumZ{0};
1237
1237
  bool offlineMode{false};
1238
1238
  bool shouldReplaceMapContent{false};
1239
1239
  int tileCacheMaxAge{0};
1240
1240
  std::string tileCachePath{};
1241
- int tileSize{0};
1241
+ int tileSize{256};
1242
+ std::string urlTemplate{};
1243
+ };
1244
+
1245
+ class RNMapsWMSTileProps final : public ViewProps {
1246
+ public:
1247
+ RNMapsWMSTileProps() = default;
1248
+ RNMapsWMSTileProps(const PropsParserContext& context, const RNMapsWMSTileProps &sourceProps, const RawProps &rawProps);
1249
+
1250
+ #pragma mark - Props
1251
+
1252
+ int maximumNativeZ{100};
1253
+ int maximumZ{100};
1254
+ int minimumZ{0};
1255
+ bool offlineMode{false};
1256
+ bool shouldReplaceMapContent{false};
1257
+ int tileCacheMaxAge{0};
1258
+ std::string tileCachePath{};
1259
+ int tileSize{256};
1242
1260
  std::string urlTemplate{};
1243
1261
  };
1244
1262
 
@@ -21,5 +21,6 @@ extern const char RNMapsMarkerComponentName[] = "RNMapsMarker";
21
21
  extern const char RNMapsOverlayComponentName[] = "RNMapsOverlay";
22
22
  extern const char RNMapsPolylineComponentName[] = "RNMapsPolyline";
23
23
  extern const char RNMapsUrlTileComponentName[] = "RNMapsUrlTile";
24
+ extern const char RNMapsWMSTileComponentName[] = "RNMapsWMSTile";
24
25
 
25
26
  } // namespace facebook::react
@@ -117,4 +117,15 @@ using RNMapsUrlTileShadowNode = ConcreteViewShadowNode<
117
117
  RNMapsUrlTileEventEmitter,
118
118
  RNMapsUrlTileState>;
119
119
 
120
+ JSI_EXPORT extern const char RNMapsWMSTileComponentName[];
121
+
122
+ /*
123
+ * `ShadowNode` for <RNMapsWMSTile> component.
124
+ */
125
+ using RNMapsWMSTileShadowNode = ConcreteViewShadowNode<
126
+ RNMapsWMSTileComponentName,
127
+ RNMapsWMSTileProps,
128
+ RNMapsWMSTileEventEmitter,
129
+ RNMapsWMSTileState>;
130
+
120
131
  } // namespace facebook::react
@@ -122,4 +122,16 @@ public:
122
122
  #endif
123
123
  };
124
124
 
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
+ };
136
+
125
137
  } // namespace facebook::react
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.21.0-alpha.138",
8
+ "version": "1.21.0-alpha.140",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",
@@ -38,7 +38,7 @@ export type MapWMSTileProps = ViewProps & {
38
38
 
39
39
  /**
40
40
  * In offline-mode tiles are not fetched from the tile servers, rather only tiles stored in the cache directory are used.
41
- * Furthermore automated tile scaling is activated: if tile at a desired zoom level is not found from the cache directory,
41
+ * Furthermore, automated tile scaling is activated: if tile at a desired zoom level is not found from the cache directory,
42
42
  * then lower zoom level tile is used (up to 4 levels lower) and scaled.
43
43
  *
44
44
  * @default false
@@ -23,6 +23,7 @@ import {Commands} from './MapViewNativeComponent';
23
23
  import GooglePolygon from './specs/NativeComponentGooglePolygon';
24
24
  import FabricMarker from './specs/NativeComponentMarker';
25
25
  import FabricUrlTile from './specs/NativeComponentUrlTile';
26
+ import FabricWMSTile from './specs/NativeComponentWMSTile.ts';
26
27
  import FabricCallout from './specs/NativeComponentCallout';
27
28
  import FabricPolyline from './specs/NativeComponentPolyline';
28
29
  import FabricCircle from './specs/NativeComponentCircle';
@@ -108,6 +109,9 @@ export default function decorateMapComponent<Type extends Component>(
108
109
  } else if (componentName === 'UrlTile') {
109
110
  // @ts-ignore
110
111
  return FabricUrlTile;
112
+ } else if (componentName === 'WMSTile') {
113
+ // @ts-ignore
114
+ return FabricWMSTile;
111
115
  }
112
116
  }
113
117
  const key = provider || 'default';
@@ -1,7 +1,7 @@
1
1
  import type {HostComponent, ViewProps} from 'react-native';
2
2
 
3
3
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
- import {Int32} from 'react-native/Libraries/Types/CodegenTypes';
4
+ import {Int32, WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
5
5
 
6
6
  export interface UrlTileFabricNativeProps extends ViewProps {
7
7
  /**
@@ -31,7 +31,7 @@ export interface UrlTileFabricNativeProps extends ViewProps {
31
31
  * @platform iOS: Apple Maps only
32
32
  * @platform Android: Supported
33
33
  */
34
- maximumNativeZ?: Int32;
34
+ maximumNativeZ?: WithDefault<Int32, 100>;
35
35
 
36
36
  /**
37
37
  * The maximum zoom level for this tile overlay.
@@ -39,7 +39,7 @@ export interface UrlTileFabricNativeProps extends ViewProps {
39
39
  * @platform iOS: Supported
40
40
  * @platform Android: Supported
41
41
  */
42
- maximumZ?: Int32;
42
+ maximumZ?: WithDefault<Int32, 100>;
43
43
 
44
44
  /**
45
45
  * The minimum zoom level for this tile overlay.
@@ -102,7 +102,7 @@ export interface UrlTileFabricNativeProps extends ViewProps {
102
102
  * @platform iOS: Apple Maps only
103
103
  * @platform Android: Supported
104
104
  */
105
- tileSize?: Int32;
105
+ tileSize?: WithDefault<Int32, 256>;
106
106
 
107
107
  /**
108
108
  * The url template of the map tileserver.
@@ -0,0 +1,107 @@
1
+ import type {HostComponent, ViewProps} from 'react-native';
2
+
3
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
+ import {Int32, WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
5
+
6
+ export interface WMSTileFabricNativeProps extends ViewProps {
7
+ /**
8
+ * The maximum native zoom level for this tile overlay i.e. the highest zoom level that the tile server provides.
9
+ * Tiles are auto-scaled for higher zoom levels.
10
+ *
11
+ * @platform iOS: Apple Maps only
12
+ * @platform Android: Supported
13
+ */
14
+ maximumNativeZ?: WithDefault<Int32, 100>;
15
+
16
+ /**
17
+ * The maximum zoom level for this tile overlay.
18
+ *
19
+ * @platform iOS: Supported
20
+ * @platform Android: Supported
21
+ */
22
+ maximumZ?: WithDefault<Int32, 100>;
23
+
24
+ /**
25
+ * The minimum zoom level for this tile overlay.
26
+ *
27
+ * @platform iOS: Supported
28
+ * @platform Android: Supported
29
+ */
30
+ minimumZ?: Int32;
31
+
32
+ /**
33
+ * In offline-mode tiles are not fetched from the tile servers, rather only tiles stored in the cache directory are used.
34
+ * Furthermore, automated tile scaling is activated: if tile at a desired zoom level is not found from the cache directory,
35
+ * then lower zoom level tile is used (up to 4 levels lower) and scaled.
36
+ *
37
+ * @default false
38
+ * @platform iOS: Apple Maps only
39
+ * @platform Android: Supported
40
+ */
41
+ offlineMode?: boolean;
42
+
43
+ /**
44
+ * Corresponds to MKTileOverlay canReplaceMapContent i.e. if true then underlying iOS basemap is not shown.
45
+ *
46
+ * @default false
47
+ * @platform iOS: Apple Maps only
48
+ * @platform Android: Not supported
49
+ */
50
+ shouldReplaceMapContent?: boolean;
51
+
52
+ /**
53
+ * Defines maximum age in seconds for a cached tile before it's refreshed.
54
+ *
55
+ * NB! Refresh logic is "serve-stale-while-refresh"
56
+ * i.e. to ensure map availability a stale (over max age) tile is served
57
+ * while a tile refresh process is started in the background.
58
+ *
59
+ * @platform iOS: Apple Maps only
60
+ * @platform Android: Supported
61
+ */
62
+ tileCacheMaxAge?: Int32;
63
+
64
+ /**
65
+ * Enable caching of tiles in the specified directory.
66
+ * Directory can be specified either as a normal path or in URL format (`file://`).
67
+ *
68
+ * Tiles are stored in tileCachePath directory as `/{z}/{x}/{y}` i.e. in sub-directories 2-levels deep,
69
+ * filename is tile y-coordinate without any filetype-extension.
70
+ *
71
+ * NB! All cache management needs to be implemented by client e.g. deleting tiles to manage use of storage space etc.
72
+ *
73
+ * @platform iOS: Apple Maps only
74
+ * @platform Android: Supported
75
+ */
76
+ tileCachePath?: string;
77
+
78
+ /**
79
+ * Tile size, default size is 256 (for tiles of 256 _ 256 pixels).
80
+ * High-res (aka 'retina') tiles are 512 (tiles of 512 _ 512 pixels)
81
+ *
82
+ * @platform iOS: Supported
83
+ * @platform Android: Supported
84
+ */
85
+ tileSize?: WithDefault<Int32, 256>;
86
+
87
+ /**
88
+ * The url template of the map tileserver.
89
+ * (URLTile) The patterns {x} {y} {z} will be replaced at runtime.
90
+ * For example, http://c.tile.openstreetmap.org/{z}/{x}/{y}.png.
91
+ *
92
+ * It is also possible to refer to tiles in local filesystem with file:///top-level-directory/sub-directory/{z}/{x}/{y}.png URL-format.
93
+ * (WMSTile) The patterns {minX} {maxX} {minY} {maxY} {width} {height} will be replaced at runtime according to EPSG:900913 specification bounding box.
94
+ * For example, https://demo.geo-solutions.it/geoserver/tiger/wms?service=WMS&version=1.1.0&request=GetMap&layers=tiger:poi&styles=&bbox={minX},{minY},{maxX},{maxY}&width={width}&height={height}&srs=EPSG:900913&format=image/png&transparent=true&format_options=dpi:213.
95
+ *
96
+ * @platform iOS: Supported
97
+ * @platform Android: Supported
98
+ */
99
+ urlTemplate: string;
100
+ }
101
+
102
+ export default codegenNativeComponent<WMSTileFabricNativeProps>(
103
+ 'RNMapsWMSTile',
104
+ {
105
+ excludedPlatforms: ['iOS'],
106
+ },
107
+ ) as HostComponent<WMSTileFabricNativeProps>;