Preparing search index...

    Function useRecipeOCR

    • Hook for managing OCR workflow in recipe forms.

      This hook orchestrates the complete OCR process for recipe data extraction:

      • Manages OCR modal state for selecting which field to extract
      • Processes images using ML Kit text recognition
      • Populates recipe fields with extracted data
      • Handles validation queues for ingredients and tags with fuzzy matching
      • Manages duplicate detection and merging for ingredients

      The hook integrates with RecipeFormContext to access and update form state. It uses useRecipeTags and useRecipeIngredients hooks for duplicate-safe additions.

      Returns UseRecipeOCRReturn

      OCR state, controls, and extraction functions

      const {
      modalField,
      isProcessingOcrExtraction,
      openModalForField,
      closeModal,
      fillOneField,
      addImageUri,
      } = useRecipeOCR();

      // Open OCR modal for title field
      openModalForField('recipeTitle');

      // Process an image for title extraction
      await fillOneField(imageUri, 'recipeTitle');