react-native-maps 1.21.0-alpha.93 → 1.21.0-alpha.94

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/lib/MapMarker.js CHANGED
@@ -30,6 +30,7 @@ const decorateMapComponent_1 = __importStar(require("./decorateMapComponent"));
30
30
  const MapMarkerNativeComponent_1 = require("./MapMarkerNativeComponent");
31
31
  const NativeComponentMarker_1 = require("./specs/NativeComponentMarker");
32
32
  const ProviderConstants_1 = require("./ProviderConstants");
33
+ const fixImageProp_1 = require("./fixImageProp");
33
34
  class MapMarker extends React.Component {
34
35
  getNativeComponent;
35
36
  getMapManagerCommand;
@@ -116,30 +117,28 @@ class MapMarker extends React.Component {
116
117
  const { stopPropagation = false } = this.props;
117
118
  if (this.fabricMarker === undefined) {
118
119
  const provider = this.context;
119
- this.fabricMarker = !(react_native_1.Platform.OS === 'ios' && provider !== ProviderConstants_1.PROVIDER_GOOGLE);
120
+ this.fabricMarker = !(react_native_1.Platform.OS === 'ios' && provider === ProviderConstants_1.PROVIDER_GOOGLE);
120
121
  }
121
122
  let icon;
122
123
  if (this.props.icon) {
123
124
  icon = react_native_1.Image.resolveAssetSource(this.props.icon) || {};
124
125
  icon = icon.uri;
126
+ if (this.fabricMarker) {
127
+ icon = (0, fixImageProp_1.fixImageProp)(this.props.icon);
128
+ }
125
129
  }
126
130
  const AIRMapMarker = this.getNativeComponent();
127
131
  let image;
128
132
  if (this.props.image) {
129
133
  if (this.fabricMarker) {
130
- if (typeof this.props.image === 'string') {
131
- image = { uri: this.props.image };
132
- }
133
- else {
134
- image = this.props.image;
135
- }
136
- }
137
- else {
138
- const resolvedImage = react_native_1.Image.resolveAssetSource(this.props.image) || {};
139
- image = resolvedImage.uri || this.props.image;
134
+ image = (0, fixImageProp_1.fixImageProp)(this.props.image);
140
135
  }
141
136
  }
142
- return (<AIRMapMarker {...this.props} ref={this.marker} image={image} icon={icon} style={[styles.marker, this.props.style]} onPress={event => {
137
+ return (<AIRMapMarker {...this.props} ref={this.marker}
138
+ // @ts-ignore
139
+ image={image}
140
+ // @ts-ignore
141
+ icon={icon} style={[styles.marker, this.props.style]} onPress={event => {
143
142
  if (stopPropagation) {
144
143
  event.stopPropagation();
145
144
  }
package/lib/MapOverlay.js CHANGED
@@ -27,6 +27,7 @@ exports.MapOverlay = void 0;
27
27
  const React = __importStar(require("react"));
28
28
  const react_native_1 = require("react-native");
29
29
  const decorateMapComponent_1 = __importStar(require("./decorateMapComponent"));
30
+ const fixImageProp_1 = require("./fixImageProp");
30
31
  class MapOverlay extends React.Component {
31
32
  getNativeComponent;
32
33
  getMapManagerCommand;
@@ -39,20 +40,9 @@ class MapOverlay extends React.Component {
39
40
  this.fabricOverlay = react_native_1.Platform.OS === 'android';
40
41
  }
41
42
  const AIRMapOverlay = this.getNativeComponent();
42
- let image;
43
- if (this.props.image) {
44
- if (this.fabricOverlay) {
45
- if (typeof this.props.image === 'string') {
46
- image = { uri: this.props.image };
47
- }
48
- else {
49
- image = this.props.image;
50
- }
51
- }
52
- else {
53
- const resolvedImage = react_native_1.Image.resolveAssetSource(this.props.image) || {};
54
- image = resolvedImage.uri || this.props.image;
55
- }
43
+ let image = this.props.image;
44
+ if (this.props.image && this.fabricOverlay) {
45
+ image = (0, fixImageProp_1.fixImageProp)(this.props.image);
56
46
  }
57
47
  return (<AIRMapOverlay {...this.props} opacity={opacity}
58
48
  // @ts-ignore
@@ -0,0 +1,4 @@
1
+ import { ImageSourcePropType } from 'react-native';
2
+ export declare function fixImageProp(image: ImageSourcePropType): {
3
+ uri: string;
4
+ } | ImageSourcePropType;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fixImageProp = void 0;
4
+ const react_native_1 = require("react-native");
5
+ function fixImageProp(image) {
6
+ if (typeof image === 'string') {
7
+ return { uri: image };
8
+ }
9
+ if (typeof image === 'number') {
10
+ // Handle local image asset (require('./image.png'))
11
+ const resolvedImage = react_native_1.Image.resolveAssetSource(image);
12
+ return resolvedImage?.uri ? { uri: resolvedImage.uri } : image;
13
+ }
14
+ return image;
15
+ }
16
+ exports.fixImageProp = fixImageProp;
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.93",
8
+ "version": "1.21.0-alpha.94",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",