Skip to content

BatchLabs/Batch-ReactNative-Plugin-Sample

Repository files navigation

Batch Logo

Batch React-Native Sample

Sample project using Batch.com platform built with react-native framework.

Getting Started

Prerequisites

  • Install Node & Watchman
  • Install Android Studio and platform dependencies
  • Install Xcode and platform dependencies

For more information, please follow the react-native documentation

This sample run on:

  • React 17.0.2
  • React-native 0.66.2
  • Node : 16.2.0

Installing

  1. Run npm install from the project root and install the dependencies:
npm install 
  1. Install iOS native dependencies with cocoapods from the ios folder :
 cd ios
 pod install

Setting up your APIKey

  • On iOS, look for your Info.plist and add the following:
<key>BatchAPIKey</key>
<string>YOUR_BATCH_API_KEY</string>
  • On Android, open android/app/build.gradle and add:
defaultConfig {
    ...
    resValue "string", "BATCH_API_KEY", "YOUR_BATCH_API_KEY"
}

Add you Firebase config

Add the google-services.json file to /android/app

Run

If you previously installed a global react-native-cli package, please remove it and use the built-in command line interface.

You can run the app on simulator using the react-native commands:

For iOS:

npx react-native run-ios

For Android:

npx react-native run-android

Or you can run it on a real device using Xcode or Android Studio (strongly recommended).

Built With