useBreathingExercise
useBreathingExercise() reads the nearest BreathingExerciseProvider context.
const { methodType, remainingTime, progress, roundData } =
useBreathingExercise();
It returns BreathingExerciseContextType:
methods,repeat, andonFinish: the active configuration.progress: a ReanimatedSharedValue<number>from0to1.roundData: a Reanimated shared value containingmethod,animationProgress, and phaseremainingTime.remainingTime: the current phase's time remaining as React state, rounded up by the provider's reaction.methodType:"inhale","hold", or"exhale"for the current phase.
Use shared values inside Reanimated worklets. For normal React rendering, use methodType and remainingTime rather than reading .value during render.
The hook throws useBreathingExercise must be used within a BreathingExercise component when called outside the provider. The BreathingExercise compound component mounts the provider automatically; BreathingExerciseProvider is available for a custom consumer tree.