UNPKG

react-native-neshan-maps

Version:

React Native wrapper for Neshan Maps SDK - The Iranian Maps and Navigation Service

119 lines (95 loc) 2.48 kB
# react-native-neshan-maps A React Native wrapper for the Neshan Maps SDK, providing mapping and navigation services for Iran. ## Installation ```bash npm install react-native-neshan-maps # or yarn add react-native-neshan-maps ``` ### Android Setup 1. Add the Neshan Maven repository to your project's build.gradle: ```gradle allprojects { repositories { // ... other repositories maven { url "https://maven.neshan.org/artifactory/public-maven" } } } ``` 2. Add your Neshan API key to your AndroidManifest.xml: ```xml <manifest> <application> <meta-data android:name="org.neshan.MAPS_API_KEY" android:value="your_api_key_here"/> </application> </manifest> ``` ### iOS Setup 1. Add the Neshan Maps SDK to your Podfile: ```ruby # Force static frameworks use_frameworks! :linkage => :static target 'YourApp' do # ... other pods pod 'NeshanMobileSDK', :modular_headers => true end ``` 2. Clean and reinstall pods: ```bash cd ios rm -rf Pods rm -rf Podfile.lock pod install ``` 3. If you're using an M1/M2 Mac, run: ```bash arch -x86_64 pod install ``` 4. Open your project in Xcode and: - Set iOS Deployment Target to 12.0 or higher - In Build Settings: - Set "Build Libraries for Distribution" to Yes - Set "Enable Bitcode" to No - For "Excluded Architectures": - For "Any iOS Simulator SDK", add "arm64" - For "Any iOS Device SDK", add "x86_64" - For "Valid Architectures", add "arm64 x86_64" 5. If you still encounter issues: - Clean the build folder in Xcode (Product > Clean Build Folder) - Delete derived data (Window > Projects > Click on arrow next to derived data path > Delete) - Close Xcode completely - Reopen the project and rebuild ## Usage ```javascript import NeshanMapView, { NeshanMethods } from 'react-native-neshan-maps'; // Set your API key NeshanMethods.setApiKey('your_api_key_here'); // Use the map component const App = () => { return ( <NeshanMapView style={{ flex: 1 }} showTraffic={true} zoomLevel={14} /> ); }; // Move camera to a specific location NeshanMethods.moveCamera({ lat: 35.7448, lng: 51.3753, zoom: 14 }); ``` ## Features - Display Neshan Maps - Show/hide traffic layer - Control zoom level - Move camera to specific locations - And more features coming soon! ## Contributing Contributions are welcome! Please feel free to submit a Pull Request. ## License MIT