@unloq/offer-sdk-react-native
v0.1.1
Published
Unloq Offer SDK for React Native
Downloads
49
Readme
Unloq Offer SDK (React Native)
The Unloq Offer SDK allows you to integrate Unloq's offer and redemption features into your React Native application.
� Prerequisites
Before you begin, ensure you have the following installed:
- Node.js (LTS version recommended)
- npm or yarn
- Java Development Kit (JDK 17) (required for Android builds)
- Android Studio (for Android SDK and Emulator)
- Expo Go app on your Android device (if testing on physical device)
🛠 Setup & Installation
- Install dependencies:
npm install # OR yarn install
🚀 Development Workflow
Running Locally (UDB Driven Dev)
To start the example app and the Metro bundler for UDB (USB) driven development:
# 1. Build the library first (important!)
npm run build
# 2. Go to example app
cd example
# 3. Start Expo
npx expo start --localhost --cRunning on Device (Android)
After running the start command:
- Android: Press
a(opens in connected device or emulator). - QR Code: Scan the QR code with Expo Go app.
Running via USB (Preferred for debugging)
Ensure your device is connected via USB and debugging is enabled.
npx expo run:android --deviceClean Native Android Build
Use this if you need a fresh build without Expo defaults or cached native code:
# 1. Force uninstall to clear user profiles
cd example
# 2. Go to example/android and nuke android folder
rm -rf android
# 3. Re-run the build
npx expo run:android📦 Building the SDK
To build the TypeScript source into lib/ (commonjs, module, typescript defs):
npm run buildNote: Always run this after making changes to the src folder before running the example app.
📱 Generating Builds (APK/IPA)
Local Build (Android APK) (example app)
To generate an APK locally using EAS:
# Install EAS CLI if not already installed
npm install -g eas-cli
# Login to Expo
eas login
# Configure project (if not done)
eas build:configure
# Build APK (Preview profile)
eas build -p android --profile preview --localCloud Build (Android APK)
To run the build on Expo's cloud servers:
npx eas build -p android --profile preview🔍 Troubleshooting
- Grey Overlay Issue: If you see a grey overlay, ensure your
UnloqInitConfighas valid API credentials and offers are successfully fetched. - Metro Connection: If Metro can't connect, ensure your device and computer are on the same Wi-Fi, or use the
--tunnelflag:npx expo start --tunnel.
