π React Native Integration
After installing the SDK and adding the Android Gradle line, integrate the SDK in your app.
1. Wrap the app with AzeooProviderβ
Use AzeooProvider at the root (or above any screen that uses the SDK). It handles initialization and connection. The authToken must be a User JWT created by your backend.
import { AzeooProvider } from 'react-native-azeoo-lib';
<AzeooProvider
apiKey={API_KEY}
userId={userId} // e.g. from auth state
authToken={authToken} // User JWT from YOUR backend
config={{
locale: 'en',
analyticsEnabled: true,
offlineEnabled: true,
}}
theme={{ isDarkMode: false, colors: { primary: '#007AFF' } }}
autoInitialize={true}
autoConnect={true}
onInitialized={() => {}}
onConnected={(profile) => {}}
onError={(error) => console.error(error)}
>
<App />
</AzeooProvider>
2. Use native viewsβ
Import the views from react-native-azeoo-lib:
import { NutritionView, TrainingView } from 'react-native-azeoo-lib';
// In your screen or tab
<NutritionView
bottomSafeArea={false}
style={{ flex: 1 }}
onLoad={() => {}}
onError={(err) => console.error(err)}
/>
<TrainingView
bottomSafeArea={false}
style={{ flex: 1 }}
onLoad={() => {}}
onError={(err) => console.error(err)}
/>
3. Optional: use after loginβ
If the user is not logged in at startup, pass userId and authToken only after login (e.g. from state). With autoConnect={true}, the SDK will connect when those props are set.