Skip to main content

πŸ”Œ 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.

Next steps​