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.

import { AzeooProvider } from 'react-native-azeoo-lib';

<AzeooProvider
apiKey={API_KEY}
userId={userId} // e.g. from auth state
authToken={authToken} // e.g. JWT
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