react-native-neshan-maps
Version:
React Native wrapper for Neshan Maps SDK - The Iranian Maps and Navigation Service
46 lines (41 loc) • 1.28 kB
JavaScript
import { NativeModules, requireNativeComponent, Platform } from 'react-native';
const LINKING_ERROR =
`The package 'react-native-neshan-maps' doesn't seem to be linked. Make sure: \n\n` +
Platform.select({ ios: "- You have run 'pod install'\n", android: '' }) +
'- You rebuilt the app after installing the package\n' +
'- You are not using Expo Go\n';
const NeshanMap = requireNativeComponent('NeshanMapView');
const NeshanMapModule = NativeModules.NeshanMapModule
? NativeModules.NeshanMapModule
: new Proxy(
{},
{
get() {
throw new Error(LINKING_ERROR);
},
}
);
export default class NeshanMapView extends React.Component {
render() {
return <NeshanMap {...this.props} />;
}
}
export const NeshanMethods = {
/**
* Set API Key for Neshan Services
* @param {string} apiKey - Your Neshan API Key
*/
setApiKey: (apiKey) => {
return NeshanMapModule.setApiKey(apiKey);
},
/**
* Move camera to specific location
* @param {Object} options - Camera options
* @param {number} options.lat - Latitude
* @param {number} options.lng - Longitude
* @param {number} options.zoom - Zoom level
*/
moveCamera: (options) => {
return NeshanMapModule.moveCamera(options);
},
};