UNPKG

one

Version:

One is a React framework for web, iOS, and Android apps.

8 lines (7 loc) • 3.58 kB
{ "version": 3, "sources": ["src/platform/specs/OneNativeCameraNativeComponent.ts"], "sourcesContent": ["import type { HostComponent, ViewProps } from 'react-native';\nimport type { DirectEventHandler, Double, Int32 } from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\nimport type * as React from 'react';\ninterface NativeProps extends ViewProps {\n active: boolean;\n facing: string;\n codeTypes: ReadonlyArray<string>;\n flash: string;\n enableTorch: boolean;\n zoom: Double;\n onNativeCameraState?: DirectEventHandler<Readonly<{\n state: string;\n }>>;\n onNativeCameraCode?: DirectEventHandler<Readonly<{\n type: string;\n data: string;\n }>>;\n // error is empty on success, otherwise \"<code>: <message>\".\n onNativeCameraPicture?: DirectEventHandler<Readonly<{\n requestId: Int32;\n uri: string;\n width: Int32;\n height: Int32;\n base64: string;\n error: string;\n }>>;\n}\ninterface NativeCommands {\n takePicture(viewRef: React.ElementRef<HostComponent<NativeProps>>, requestId: Int32, quality: Double, base64: boolean): void;\n}\nconst NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\nconst {\n ConditionallyIgnoredEventHandlers\n} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');\nconst {\n dispatchCommand\n} = require(\"react-native/Libraries/ReactNative/RendererProxy\");\nlet nativeComponentName = 'OneNativeCamera';\nexport const __INTERNAL_VIEW_CONFIG = {\n uiViewClassName: \"OneNativeCamera\",\n directEventTypes: {\n topNativeCameraState: {\n registrationName: \"onNativeCameraState\"\n },\n topNativeCameraCode: {\n registrationName: \"onNativeCameraCode\"\n },\n topNativeCameraPicture: {\n registrationName: \"onNativeCameraPicture\"\n }\n },\n validAttributes: {\n active: true,\n facing: true,\n codeTypes: true,\n flash: true,\n enableTorch: true,\n zoom: true,\n ...ConditionallyIgnoredEventHandlers({\n onNativeCameraState: true,\n onNativeCameraCode: true,\n onNativeCameraPicture: true\n })\n }\n};\nexport default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);\nexport const Commands = {\n takePicture(ref, requestId, quality, base64) {\n dispatchCommand(ref, \"takePicture\", [requestId, quality, base64]);\n }\n};"], "mappings": "AAgCA,MAAMA,IAA0B,QAAQ,gEAAgE;AACxG,MAAM;AAAA,EACJ,mCAAAC;AACF,IAAI,QAAQ,yDAAyD;AACrE,MAAM;AAAA,EACJ,iBAAAC;AACF,IAAI,QAAQ,kDAAkD;AAC9D,IAAIC,IAAsB;AACnB,MAAMC,IAAyB;AAAA,EACpC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,IAChB,sBAAsB;AAAA,MACpB,kBAAkB;AAAA,IACpB;AAAA,IACA,qBAAqB;AAAA,MACnB,kBAAkB;AAAA,IACpB;AAAA,IACA,wBAAwB;AAAA,MACtB,kBAAkB;AAAA,IACpB;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,WAAW;AAAA,IACX,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,GAAGH,EAAkC;AAAA,MACnC,qBAAqB;AAAA,MACrB,oBAAoB;AAAA,MACpB,uBAAuB;AAAA,IACzB,CAAC;AAAA,EACH;AACF;AACA,IAAOI,IAAQL,EAAwB,IAAIG,GAAqB,MAAMC,CAAsB;AACrF,MAAME,IAAW;AAAA,EACtB,YAAYC,GAAKC,GAAWC,GAASC,GAAQ;AAC3C,IAAAR,EAAgBK,GAAK,eAAe,CAACC,GAAWC,GAASC,CAAM,CAAC;AAAA,EAClE;AACF;", "names": ["NativeComponentRegistry", "ConditionallyIgnoredEventHandlers", "dispatchCommand", "nativeComponentName", "__INTERNAL_VIEW_CONFIG", "OneNativeCameraNativeComponent_default", "Commands", "ref", "requestId", "quality", "base64"] }