In this file we share a way to upgrade previous versions of react-native-situm-plugin or @situm/react-native-wayfinding plugins to newer versions.
-
Update this plugin to 3.0.0 version on your package.json and install via npm or yarn.
yarn add @situm/react-native@^3.0.0 -
Install our plugin peer dependencies, as React Native does not do it for you.
yarn add react-native-permissions react-native-situm-plugin react-native-webview -
As we have moved from Google Maps to Mapbox, remove the Google Maps API Key from “android/src/main/AndroidManifest.xml” file:
<meta-data android:name="com.google.android.geo.API_KEY" android:value="GOOGLE_MAPS_APIKEY" /> -
Wrap your application with our new component
<SitumProvider>, this component handles our SDK status and provides it to usage inside your application -
Go to your usage of our component
<Mapview/>and :- Remove the
userandapikeyprops. - Pass the mapboxApiKey props, otherwise only your floor plan will be shown without underlying map.
- Remove the
// your imports
const SITUM_EMAIL = "YOUR_EMAIL_HERE";
const SITUM_API_KEY = "YOUR_APIKEY_HERE";
const SITUM_BUILDING_ID = "YOUR_BUILDING_ID_HERE";
const App: React.FC = () => {
return (
<View>
<SitumProvider email={SITUM_EMAIL} apiKey={SITUM_API_KEY}>
<MapView
buildingId={SITUM_BUILDING_ID}
// other props
/>
</SitumProvider>
</View>
);
};