UNPKG

one

Version:

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

8 lines (7 loc) • 2.53 kB
{ "version": 3, "sources": ["src/platform/specs/OneKotlinHostNativeComponent.ts"], "sourcesContent": ["// the device host for a composable imported from a react native `.kt` file:\n// the app's generated view dispatch renders it with the element's props as\n// json text, and reports each callback call back as an event.\nimport type { ViewProps } from 'react-native';\nimport type { DirectEventHandler, Double } from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\ntype KotlinHostEvent = Readonly<{\n name: string;\n args: string;\n}>;\ntype KotlinHostSizeEvent = Readonly<{\n width: Double;\n height: Double;\n}>;\ninterface NativeProps extends ViewProps {\n // the kotlin source id the bundler derived from the imported file's path\n source: string;\n view: string;\n contractHash: string;\n props: string;\n onHostEvent?: DirectEventHandler<KotlinHostEvent>;\n onHostSizeChange?: DirectEventHandler<KotlinHostSizeEvent>;\n}\nconst NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\nconst {\n ConditionallyIgnoredEventHandlers\n} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');\nlet nativeComponentName = 'OneKotlinHost';\nexport const __INTERNAL_VIEW_CONFIG = {\n uiViewClassName: \"OneKotlinHost\",\n directEventTypes: {\n topHostEvent: {\n registrationName: \"onHostEvent\"\n },\n topHostSizeChange: {\n registrationName: \"onHostSizeChange\"\n }\n },\n validAttributes: {\n source: true,\n view: true,\n contractHash: true,\n props: true,\n ...ConditionallyIgnoredEventHandlers({\n onHostEvent: true,\n onHostSizeChange: true\n })\n }\n};\nexport default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);"], "mappings": "AAuBA,MAAMA,IAA0B,QAAQ,gEAAgE;AACxG,MAAM;AAAA,EACJ,mCAAAC;AACF,IAAI,QAAQ,yDAAyD;AACrE,IAAIC,IAAsB;AACnB,MAAMC,IAAyB;AAAA,EACpC,iBAAiB;AAAA,EACjB,kBAAkB;AAAA,IAChB,cAAc;AAAA,MACZ,kBAAkB;AAAA,IACpB;AAAA,IACA,mBAAmB;AAAA,MACjB,kBAAkB;AAAA,IACpB;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,cAAc;AAAA,IACd,OAAO;AAAA,IACP,GAAGF,EAAkC;AAAA,MACnC,aAAa;AAAA,MACb,kBAAkB;AAAA,IACpB,CAAC;AAAA,EACH;AACF;AACA,IAAOG,IAAQJ,EAAwB,IAAIE,GAAqB,MAAMC,CAAsB;", "names": ["NativeComponentRegistry", "ConditionallyIgnoredEventHandlers", "nativeComponentName", "__INTERNAL_VIEW_CONFIG", "OneKotlinHostNativeComponent_default"] }