expo-camera
Version:
A React component that renders a preview for the device's either front or back camera. Camera's parameters like zoom, auto focus, white balance and flash mode are adjustable. With expo-camera, one can also take photos and record videos that are saved to t
43 lines (40 loc) • 874 B
text/typescript
/*
* Native web camera (Android) has a torch: boolean
*/
export function convertFlashModeJSONToNative(input: string): boolean {
switch (input) {
case 'torch':
return true;
case 'on':
case 'off':
case 'auto':
default:
return false;
}
}
export function convertWhiteBalanceJSONToNative(input: string): MeteringMode | undefined {
switch (input) {
case 'on':
case 'auto':
return 'continuous';
case 'off':
return 'none';
case 'singleShot':
return 'single-shot';
default:
return undefined;
}
}
export function convertAutoFocusJSONToNative(input: string): MeteringMode | undefined {
switch (input) {
case 'on':
case 'auto':
return 'continuous';
case 'off':
return 'manual';
case 'singleShot':
return 'single-shot';
default:
return undefined;
}
}