$ npm install react-native-steerpath-smart-map --save
or
$ yarn add react-native-steerpath-smart-map
We only support Cocoapod linking for iOS at the moment
In your ios/Podfile
, add the following lines to the top it:
source 'https://github.com/CocoaPods/Specs.git'
source 'https://bitbucket.org/nimbledevices/steerpath-mapbox-ios-podspec.git'
source 'https://bitbucket.org/nimbledevices/steerpath-smart-sdk-podspec.git'
Run:
$ pod install
In your android/app/build.gradle
, add the following lines before the
dependencies {}
block:
repositories {
// For Steerpath Smart Map SDK
maven { url "https://android-sdk.steerpath.net" }
}
If you are using React-Native < 0.60:
$ react-native link react-native-steerpath-smart-map
You need to add the following lines to your html file (index.html
if using
create-react-app
):
<script src="https://s3-eu-west-1.amazonaws.com/steerpath-web-sdk/releases/smart/1.0.14/steerpath-smart-1.0.14.min.js"></script>
<link
href="https://s3-eu-west-1.amazonaws.com/steerpath-web-sdk/releases/smart/1.0.14/steerpath-smart-1.0.14.css"
rel="stylesheet"
/>
$ cd example
$ yarn install --force
$ cd ios
$ pod update
$ cd ..
$ react-native run-ios # for ios
$ react-native run-android # for android
import {
SmartMapView,
SmartMapManager,
} from "react-native-steerpath-smart-map";
const API_KEY = "...";
SmartMapManager.start(API_KEY);
<SmartMapView
style={{ flex: 1 }}
apiKey={API_KEY} // This is required only if you are using this component in the web
/>;
General naming for the configuration file is steerpath_config.json. If your Smart SDK Api Key requires other naming, name your configuration file according to that. There are two options of how to use config file:
-
Add configuration file to your react native project folder and use startWithConfig(iOS/Android) or start(web) method of SmartMapMananger. See config.js and App.tsx or App.web.tsx of our example application.
-
Add a configuration file to your project. See platform specific instructions below.
Add configuration file to /src/main/assets folder of your Android project.
Add configuration file to your Xcode project and select your application target
Add config file to your project and export it from there to the component where the SmartMapManager.start() is initialised. You can pass the config file as the second parameter to the start() method as a string. Below is the TypeScript snippet from the example project:
(SmartMapManager as { start: (apiKey: string, config: Record<string, unknown>) => void }).start(
API_KEY,
JSON.parse(CONFIG_STRING),
);
OfflineBundle (.sff) is a package containing indoor map tiles, (world tiles excluded), map style, routing data, positioning data and map object meta data. With OfflineBundle, maps & indoor positioning works without network connection.
Steps to enable OfflineBundle
- Copy provided .sff file into your application project's /assets folder
- Add following flag to your app's Manifest.xml:
<meta-data android:name="SP_OFFLINE_DATA" android:value="theNameOfYourOffineBundle.sff"/>
The offline bundle should have “.sff” extension. Rename it to “sp_offline_data.sff” and drag it to your Xcode project. Select “Copy items if needed” and select your application target.
The default offline data file name is “sp_offline_data.sff”. If you want to use a custom name, you can add the following key to your application’s Info.plist (Please make sure that the offline data file name matches):
<key>SP_OFFLINE_DATA</key>
<string>sp_offline_data.sff</string>
Using the offline bundle with react-native-steerpath-smartmap package on web platform is not yet supported. You can use the example of Steerpath Core SDK found in the Offline bundle ./style folder to view maps.
- For development
For the first time: Run yarn install && yarn build
in the root project, then go to example and run
yarn install
again.
Everytime making changes in the root project, run yarn build
again and go to
example project and yarn add react-native-steerpath-smart-map --force
to see
the changes in the example project. Make any changes to the example project if necessary.
- For releasing
Run the Typescript compiler and then npm publish:
$ yarn build
$ yarn publish