From ba21875001df2e260feb87d71411ff89fe6942ea Mon Sep 17 00:00:00 2001 From: Felipe Constantino Date: Fri, 23 Feb 2018 14:57:21 -0300 Subject: [PATCH] feat(types): add FaceDetector declarations + Fix type errors on "noImplicitAny" compilerOption --- types/index.d.ts | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index f95546a..079bf8a 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -12,16 +12,16 @@ import { Component } from 'react'; import { ViewProperties } from "react-native"; -type AutoFocus = { on, off }; -type FlashMode = { on, off, torch, auto } -type CameraType = { front, back } -type WhiteBalance = { sunny, cloudy, shadow, incandescent, fluorescent, auto } -type BarCodeType = { aztec, code128, code39, code39mod43, code93, ean13, ean8, pdf417, qr, upce, interleaved2of5, itf14, datamatrix } -type VideoQuality = { '2160p', '1080p', '720p', '480p', '4:3' } +type AutoFocus = { on: any, off: any }; +type FlashMode = { on: any, off: any, torch: any, auto: any }; +type CameraType = { front: any, back: any }; +type WhiteBalance = { sunny: any, cloudy: any, shadow: any, incandescent: any, fluorescent: any, auto: any }; +type BarCodeType = { aztec: any, code128: any, code39: any, code39mod43: any, code93: any, ean13: any, ean8: any, pdf417: any, qr: any, upce: any, interleaved2of5: any, itf14: any, datamatrix: any }; +type VideoQuality = { '2160p': any, '1080p': any, '720p': any, '480p': any, '4:3': any }; -type FaceDetectionClassifications = { all, none } -type FaceDetectionLandmarks = { all, none } -type FaceDetectionMode = { fast, accurate } +type FaceDetectionClassifications = { all: any, none: any }; +type FaceDetectionLandmarks = { all: any, none: any }; +type FaceDetectionMode = { fast: any, accurate: any }; export interface Constants { AutoFocus: AutoFocus; @@ -37,7 +37,7 @@ export interface Constants { } } -export interface RNCameraProps extends ViewProperties { +export interface RNCameraProps { autoFocus?: keyof AutoFocus; type?: keyof CameraType; flashMode?: keyof FlashMode; @@ -139,7 +139,7 @@ interface RecordResponse { uri: string; } -export class RNCamera extends Component { +export class RNCamera extends Component { static Constants: Constants; takePictureAsync(options?: TakePictureOptions): Promise; @@ -150,6 +150,18 @@ export class RNCamera extends Component { getSupportedRatiosAsync(): Promise; } +interface DetectionOptions { + mode?: keyof FaceDetectionMode, + detectLandmarks?: keyof FaceDetectionLandmarks, + runClassifications?: keyof FaceDetectionClassifications +} + +export class FaceDetector { + private constructor(); + static Constants: Constants['FaceDetection']; + static detectFacesAsync(uri: string, options?: DetectionOptions): Promise; +} + // -- DEPRECATED CONTENT BELOW /**