react-native-vetrix-games
v0.1.8
Published
sdk for npx vetrix
Downloads
863
Readme
react-native-vetrix-games
SDK for Vetrix Games Hub — a collection of interactive mini-games (Millionaire Hunter, Fortune Wheel, Dice, Trivia, Raffle Draw, and more) for React Native apps.
Installation
npm install react-native-vetrix-gamesiOS
cd ios && pod installThe SDK depends on lottie-ios 4.x (declared in the podspec as ~> 4.0). CocoaPods resolves this automatically. If your app already uses lottie-ios or lottie-react-native, it will share the same copy — no conflicts as long as you're on lottie-ios 4.x.
Android
No extra setup required. The SDK ships with Lottie 6.6.2 by default.
Overriding the Lottie version
If your app already uses a different version of Lottie (e.g. via lottie-react-native or a direct dependency), you can override the version used by the SDK. Add this to your root build.gradle (or build.gradle.kts):
// android/build.gradle
ext {
lottieVersion = "6.4.0" // your preferred version (must be 6.x)
}The SDK reads rootProject.ext.lottieVersion at build time. If not set, it falls back to its built-in default (6.6.2). This follows the same pattern used for kotlinVersion, compileSdkVersion, and other overridable properties.
Note: The SDK requires Lottie 6.x APIs. Versions below 6.0.0 are not supported.
Usage
Basic
import { VetrixGamesHub } from 'react-native-vetrix-games';
export default function App() {
return (
<VetrixGamesHub
apiUrl="https://your-api.example.com/service"
externalToken={userAuthToken}
/>
);
}With all options
import { VetrixGamesHub } from 'react-native-vetrix-games';
export default function App() {
return (
<VetrixGamesHub
apiUrl="https://your-api.example.com/service"
externalToken={userAuthToken}
onExit={() => navigation.goBack()}
onError={(error) => console.error('Session error:', error)}
theme={{
colors: {
primary: '#6C63FF',
accent: '#FFD700',
background: '#0A0A2E',
},
}}
/>
);
}Props
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| apiUrl | string | Yes | API endpoint URL. |
| externalToken | string | Yes | Auth token from the host app, used to initialize a player session. |
| onExit | () => void | No | Called when the user taps "Logout" on the Profile screen. Use this to navigate away from the hub. |
| onError | (error: Error \| string) => void | No | Called when session initialization fails. Receives the error. |
| theme | Partial<VetrixTheme> | No | Theme color overrides. |
Note: Device analytics (OS, version, screen resolution, timezone, etc.) are collected automatically by the SDK — no configuration needed.
VetrixTheme
{
colors: Partial<{
background: string;
surface: string;
primary: string;
secondary: string;
accent: string;
success: string;
error: string;
warning: string;
textPrimary: string;
textSecondary: string;
textMuted: string;
border: string;
gold: string;
}>;
}