react-native-maps 1.21.0-alpha.93 → 1.21.0-alpha.95
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 +12 -19
- package/lib/MapOverlay.js +4 -14
- package/lib/fixImageProp.d.ts +4 -0
- package/lib/fixImageProp.js +16 -0
- package/package.json +1 -1
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,22 @@ 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
|
|
120
|
+
this.fabricMarker = !(react_native_1.Platform.OS === 'ios' && provider === ProviderConstants_1.PROVIDER_GOOGLE);
|
|
120
121
|
}
|
|
121
122
|
let icon;
|
|
122
|
-
if (this.props.icon) {
|
|
123
|
-
icon =
|
|
124
|
-
icon = icon.uri;
|
|
123
|
+
if (this.props.icon && this.fabricMarker) {
|
|
124
|
+
icon = (0, fixImageProp_1.fixImageProp)(this.props.icon);
|
|
125
125
|
}
|
|
126
|
-
const AIRMapMarker = this.getNativeComponent();
|
|
127
126
|
let image;
|
|
128
|
-
if (this.props.image) {
|
|
129
|
-
|
|
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;
|
|
140
|
-
}
|
|
127
|
+
if (this.props.image && this.fabricMarker) {
|
|
128
|
+
image = (0, fixImageProp_1.fixImageProp)(this.props.image);
|
|
141
129
|
}
|
|
142
|
-
|
|
130
|
+
const AIRMapMarker = this.getNativeComponent();
|
|
131
|
+
return (<AIRMapMarker {...this.props} ref={this.marker}
|
|
132
|
+
// @ts-ignore
|
|
133
|
+
image={image}
|
|
134
|
+
// @ts-ignore
|
|
135
|
+
icon={icon} style={[styles.marker, this.props.style]} onPress={event => {
|
|
143
136
|
if (stopPropagation) {
|
|
144
137
|
event.stopPropagation();
|
|
145
138
|
}
|
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
|
-
|
|
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,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.
|
|
8
|
+
"version": "1.21.0-alpha.95",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|