1.0.0 • Published 2 years ago

mx-mobile-widget v1.0.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

Setup

First, you will need to set up your environment so that you can run React Native apps. See https://reactnative.dev/docs/environment-setup for instructions on how to do that. In addition, you'll need to download and install Android Studio, Xcode, and Node v17.

Once your environment is setup, create a config.json file that looks like the one below, but with the appropriate values (all of which you can get from Batcave):

{
  "MX_CLIENT_ID": "...",
  "MX_API_KEY": "...",
  "MX_USER_GUID": "...",
  "MX_ENVIRONMENT": "integration"
}

Next, install dependencies, link native libraries, and then install and run the app in an iOS or Android emulator. Here are all of the commands you need to do that:

npm install             # Installs dependencies
npm link                # Links native libraries in iOS and Android apps
npm run ios             # Installs and runs app in iOS emulator
npm run android         # Installs and runs app in Android emulator

Other useful commands for developers:

npm run build           # Run TypeScript compiler
npm run dist            # Compile and save output to dist directory
npm run test            # Run unit tests
npm run test:coverage   # Run unit tests and generate code coverage report
npm run open:coverage   # Open code coverage report
npm run generate        # Run code generators

Installing on a new app

npm pack
cd ..

npx react-native init MxMobileWidgetDemo --version 0.64.3
cd MxMobileWidgetDemo

npm install <path to mx-mobile-widget-sdk tarfile>
npm install --save react-native-webview
npx react-native link react-native-webview
cd ios
pod install
cd ..

npm run ios