This React Native sample works like the iOS and Android samples, with a few differences.
⚠️ WarningThis sample is designed to show you how to use the iTwin Mobile SDK in a React Native app. However, unlike the iOS and Android samples, it is strongly recommended that you do not use this sample as a basis for a new app. In addition to increasing the download size of your app, React Native has its own JavaScript runtime that is completely separate from the iTwin.js JavaScript runtime. Both runtimes consume significant memory, so we only recommend this approach when adding iTwin.js to an existing non-trivial React Native app. For apps that just present a full-screen web view to the user into which the iTwin-based web app is loaded, React Native does not provide much benefit.
- You must install node 18 on your computer, and it needs to be the default node found in your path.
- Run a Command Prompt/Terminal.
- cd into the
ReactNative/iTwinRNStarter
directory of this repository. - Run
npm install
.
- Run Terminal.
- cd into the
ReactNative/iTwinRNStarter/ios
directory of this repository. - Run
pod install
. - Follow the iOS samples instructions here. Note: Instead of opening the xcodeproj for the React Native sample, you must open the xcworkspace. The workspace file is
ReactNative/ios/iTwinRNStarter.xcworkspace
.
Follow the Android samples instructions here. The Android sample is in ReactNative/android
.