React Native Examples
Minimal setup with AzeooProvider
Wrap your app (or the part that uses the SDK) with AzeooProvider, then use NutritionView or TrainingView:
import { AzeooProvider, NutritionView } from 'react-native-azeoo-lib';
export default function App() {
return (
<AzeooProvider
apiKey="your-api-key"
userId="user-123"
authToken="jwt-token"
config={{ locale: 'en', analyticsEnabled: true, offlineEnabled: true }}
theme={{ isDarkMode: false, colors: { primary: '#007AFF' } }}
autoInitialize={true}
autoConnect={true}
>
<NutritionView
bottomSafeArea={false}
style={{ flex: 1 }}
onLoad={() => {}}
onError={(e) => console.error(e)}
/>
</AzeooProvider>
);
}
After login
Pass userId and authToken from your auth state so the SDK connects after login:
const [user, setUser] = useState(null);
<AzeooProvider
apiKey={API_KEY}
userId={user?.id ?? ''}
authToken={user?.token ?? ''}
autoInitialize={true}
autoConnect={true}
onConnected={(profile) => console.log('Connected', profile?.name)}
onError={(err) => console.error(err)}
config={{ locale: 'en', analyticsEnabled: true, offlineEnabled: true }}
>
{user ? <MainTabs /> : <LoginScreen onLogin={setUser} />}
</AzeooProvider>
Full example app
See the React Native example in the repository for a complete app with login, tabs (Home, Nutrition, Training, SDK), and SDK integration.