UNPKG

react-native-vision-camera

Version:

VisionCamera is the fastest and most powerful Camera for react-native.

22 lines (21 loc) 770 B
import { useEffect } from 'react'; import { VisionCameraWorkletsProxy } from '../../third-party/VisionCameraWorkletsProxy'; export function useExposureUpdater(controller, exposure) { useEffect(() => { if (controller == null) return; if (exposure == null) return; if (typeof exposure === 'number') { // number controller.setExposureBias(exposure); return; } else { // SharedValue<number> controller.setExposureBias(exposure.get()); const listener = VisionCameraWorkletsProxy.bindUIUpdatesToController(exposure, controller, 'setExposureBias'); return () => listener.remove(); } }, [controller, exposure]); }