Skip to main content

Nutrition Module

The Nutrition module provides all nutrition-related UI screens and functionality.

Accessing the Module​

import { AzeooUI } from '@azeoo/react-native-sdk';

const nutrition = AzeooUI.instance.nutrition;

Methods​

showMainScreen​

Shows the main nutrition screen with an overview of all nutrition features.

showMainScreen(options?: { bottomSafeArea?: boolean })

Parameters:

  • options (object, optional): Configuration options
    • bottomSafeArea (boolean, optional): Whether to apply bottom safe area. Defaults to true.

Example:

nutrition.showMainScreen({ bottomSafeArea: true });

showNutritionPlans​

Shows the nutrition plans screen where users can browse available nutrition plans.

showNutritionPlans()

Example:

nutrition.showNutritionPlans();

showNutritionPlan​

Shows a specific nutrition plan.

showNutritionPlan(planId: string)

Parameters:

  • planId (string): The ID of the nutrition plan to display.

Example:

nutrition.showNutritionPlan('plan-123');

showUserNutritionPlan​

Shows the user's current nutrition plan.

showUserNutritionPlan()

Example:

nutrition.showUserNutritionPlan();

showRecipes​

Shows the recipes screen where users can browse recipes.

showRecipes()

Example:

nutrition.showRecipes();

showRecipe​

Shows a specific recipe.

showRecipe(recipeId: number, options?: { recipeName?: string })

Parameters:

  • recipeId (number): The ID of the recipe to display.
  • options (object, optional): Configuration options
    • recipeName (string, optional): Optional recipe name for better navigation.

Example:

nutrition.showRecipe(12345, { recipeName: 'Chicken Salad' });

showBarcodeScanner​

Shows the barcode scanner screen for scanning food products.

showBarcodeScanner()

Example:

nutrition.showBarcodeScanner();

showMobileScanner​

Shows the mobile scanner (alternative scanner implementation).

showMobileScanner()

Example:

nutrition.showMobileScanner();

showCart​

Shows the shopping cart screen.

showCart()

Example:

nutrition.showCart();

showNutritionSearch​

Shows the nutrition search screen for searching foods and nutrition information.

showNutritionSearch()

Example:

nutrition.showNutritionSearch();

showAddSelection​

Shows the add selection screen for adding food items.

showAddSelection()

Example:

nutrition.showAddSelection();

showAddFood​

Shows the add food screen.

showAddFood()

Example:

nutrition.showAddFood();

showAddMeal​

Shows the add meal screen.

showAddMeal()

Example:

nutrition.showAddMeal();

Complete Example​

import React from 'react';
import { View, TouchableOpacity, Text, StyleSheet } from 'react-native';
import { AzeooUI } from '@azeoo/react-native-sdk';

const NutritionScreen = () => {
const nutrition = AzeooUI.instance.nutrition;

const menuItems = [
{ label: 'Main Screen', action: () => nutrition.showMainScreen() },
{ label: 'Nutrition Plans', action: () => nutrition.showNutritionPlans() },
{ label: 'Recipes', action: () => nutrition.showRecipes() },
{ label: 'Barcode Scanner', action: () => nutrition.showBarcodeScanner() },
{ label: 'Shopping Cart', action: () => nutrition.showCart() },
{ label: 'Search', action: () => nutrition.showNutritionSearch() },
];

return (
<View style={styles.container}>
{menuItems.map((item, index) => (
<TouchableOpacity
key={index}
style={styles.button}
onPress={item.action}
>
<Text style={styles.buttonText}>{item.label}</Text>
</TouchableOpacity>
))}
</View>
);
};

const styles = StyleSheet.create({
container: {
flex: 1,
padding: 20,
},
button: {
backgroundColor: '#0284C7',
padding: 15,
borderRadius: 8,
marginBottom: 10,
},
buttonText: {
color: 'white',
fontSize: 16,
textAlign: 'center',
},
});

export default NutritionScreen;

Next Steps​