react-native-anavi
Version:
react native amap navigation component, Android + iOS
47 lines (39 loc) • 1.66 kB
JavaScript
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
import * as React from 'react';
import * as PropTypes from 'prop-types';
import { requireNativeComponent, ViewPropTypes } from 'react-native';
const PointPropType = PropTypes.shape({
latitude: PropTypes.number.isRequired,
longitude: PropTypes.number.isRequired,
title: PropTypes.string,
subtitle: PropTypes.string
});
/**
* @ignore
*/
export default class MultiPoint extends React.PureComponent {
constructor(...args) {
super(...args);
_defineProperty(this, "onItemPress", ({
nativeEvent
}) => {
if (this.props.onItemPress) {
this.props.onItemPress(this.props.points[nativeEvent.index]);
}
});
}
render() {
// @ts-ignore
return /*#__PURE__*/React.createElement(AMapMultiPoint, _extends({}, this.props, {
onItemPress: this.onItemPress
}));
}
} // @ts-ignore
_defineProperty(MultiPoint, "propTypes", { ...ViewPropTypes,
points: PropTypes.arrayOf(PointPropType).isRequired,
image: PropTypes.string,
onItemPress: PropTypes.func
});
const AMapMultiPoint = requireNativeComponent('AMapMultiPoint', MultiPoint);
//# sourceMappingURL=multi-point.js.map