mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-27 19:11:15 +00:00
Fixed errors: `View.propTypes has been deprecated and will be removed in a future version of ReactNative. Use ViewPropTypes instead.` `Warning: PropTypes has been moved to a separate package. Accessing React.PropTypes is no longer supported and will be removed completely in React 16. Use the prop-types package on npm instead.`
55 lines
1.2 KiB
JavaScript
55 lines
1.2 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import {
|
|
View,
|
|
ViewPropTypes,
|
|
requireNativeComponent,
|
|
StyleSheet,
|
|
Platform,
|
|
NativeModules,
|
|
Animated,
|
|
findNodeHandle,
|
|
} from 'react-native';
|
|
|
|
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
|
|
const viewConfig = {
|
|
uiViewClassName: 'RCTMapboxAnnotation',
|
|
validAttributes: {
|
|
coordinate: true,
|
|
},
|
|
};
|
|
|
|
const propTypes = {
|
|
...ViewPropTypes,
|
|
id: PropTypes.string.isRequired,
|
|
title: PropTypes.string,
|
|
subtitle: PropTypes.string,
|
|
coordinate: PropTypes.shape({
|
|
latitude: PropTypes.number.isRequired,
|
|
longitude: PropTypes.number.isRequired,
|
|
}).isRequired,
|
|
|
|
};
|
|
|
|
class MapboxAnnotation extends React.Component {
|
|
setNativeProps(nativeProps) {
|
|
this.marker.setNativeProps(nativeProps);
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<RCTMapboxAnnotation
|
|
ref={ref => { this.marker = ref; }}
|
|
{...this.props}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
MapboxAnnotation.propTypes = propTypes;
|
|
MapboxAnnotation.viewConfig = viewConfig;
|
|
|
|
const RCTMapboxAnnotation = requireNativeComponent('RCTMapboxAnnotation', MapboxAnnotation);
|
|
module.exports = MapboxAnnotation;
|