Install & init project
npm install -g expo-cli
expo init <project name>
cd <project name>
expo install react-native-webview
npm install longdo-map-react-native
presets: [
'babel-preset-expo',
['@babel/preset-env', { "targets": "iOS >= 11, Android >= 56" }],
],
"ios": {
"bundleIdentifier": "BUNDLE_ID",
...
"android": {
"package": "PACKAGE_NAME",
Then, Register BUNDLE_ID, PACKAGE_NAME at https://map.longdo.com/api to obtain API_KEY
Follow React Native CLI Quickstart instruction and run
npm install react-native-webview longdo-map-react-native
npm install -D @babel/preset-env
presets: [
'module:metro-react-native-babel-preset',
['@babel/preset-env', { "targets": "iOS >= 11, Android >= 56" }],
],
"name": PROJECT_NAME,
Register PROJECT_NAME at https://map.longdo.com/api to obtain API_KEY
import Longdo from 'longdo-map-react-native';
In main App function
Longdo.apiKey = 'API_KEY';
If module fail to auto-detect app's bundle ID, add
Longdo.bundleId = 'REGISTERED_ID';
Under root View
<Longdo.MapView />
In StyleSheet
alignItems: 'stretch'
For complete file, see example/App.js
npm run ios
npm run android
Follow this instruction to run on Mac M1
- 3.x: Vector map GL backend
- 1.x: Raster map backend