mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-27 22:54:46 +08:00
Fixed image source for MapView annotations
Summary: public resolveAssetSource was not being called on MapView image any more, resulting in an error when using `require(./imagename.png)` syntax. Reviewed By: fredliu Differential Revision: D2772560 fb-gh-sync-id: 0a50a9c3ba727406343a0f47c84941e95df9cadd
This commit is contained in:
committed by
facebook-github-bot-4
parent
56fd138fd3
commit
9901bf20e1
@@ -294,8 +294,12 @@ const MapView = React.createClass({
|
||||
}}
|
||||
source={image}
|
||||
/>;
|
||||
image = undefined;
|
||||
}
|
||||
if (view) {
|
||||
if (image) {
|
||||
console.warn('`image` and `view` both set on annotation. Image will be ignored.');
|
||||
}
|
||||
var viewIndex = children.length;
|
||||
children.push(React.cloneElement(view, {
|
||||
style: [styles.annotationView, view.props.style || {}]
|
||||
@@ -319,19 +323,22 @@ const MapView = React.createClass({
|
||||
style: [styles.calloutView, detailCalloutView.props.style || {}]
|
||||
}));
|
||||
}
|
||||
['hasLeftCallout', 'onLeftCalloutPress'].forEach(key => {
|
||||
if (annotation[key]) {
|
||||
console.warn('`' + key + '` is deprecated. Use leftCalloutView instead.');
|
||||
}
|
||||
});
|
||||
['hasRightCallout', 'onRightCalloutPress'].forEach(key => {
|
||||
if (annotation[key]) {
|
||||
console.warn('`' + key + '` is deprecated. Use rightCalloutView instead.');
|
||||
}
|
||||
});
|
||||
if (__DEV__) {
|
||||
['hasLeftCallout', 'onLeftCalloutPress'].forEach(key => {
|
||||
if (annotation[key]) {
|
||||
console.warn('`' + key + '` is deprecated. Use leftCalloutView instead.');
|
||||
}
|
||||
});
|
||||
['hasRightCallout', 'onRightCalloutPress'].forEach(key => {
|
||||
if (annotation[key]) {
|
||||
console.warn('`' + key + '` is deprecated. Use rightCalloutView instead.');
|
||||
}
|
||||
});
|
||||
}
|
||||
return {
|
||||
...annotation,
|
||||
tintColor: tintColor && processColor(tintColor),
|
||||
image: image && resolveAssetSource(image),
|
||||
viewIndex,
|
||||
leftCalloutViewIndex,
|
||||
rightCalloutViewIndex,
|
||||
|
||||
Reference in New Issue
Block a user