2.0.5 • Published 5 months ago
react-native-neshan-maps v2.0.5
react-native-neshan-maps
A React Native wrapper for the Neshan Maps SDK, providing mapping and navigation services for Iran.
Installation
npm install react-native-neshan-maps
# or
yarn add react-native-neshan-maps
Android Setup
- Add the Neshan Maven repository to your project's build.gradle:
allprojects {
repositories {
// ... other repositories
maven { url "https://maven.neshan.org/artifactory/public-maven" }
}
}
- Add your Neshan API key to your AndroidManifest.xml:
<manifest>
<application>
<meta-data
android:name="org.neshan.MAPS_API_KEY"
android:value="your_api_key_here"/>
</application>
</manifest>
iOS Setup
- Add the Neshan Maps SDK to your Podfile:
# Force static frameworks
use_frameworks! :linkage => :static
target 'YourApp' do
# ... other pods
pod 'NeshanMobileSDK', :modular_headers => true
end
- Clean and reinstall pods:
cd ios
rm -rf Pods
rm -rf Podfile.lock
pod install
- If you're using an M1/M2 Mac, run:
arch -x86_64 pod install
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"
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
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