UNPKG

one

Version:

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

8 lines (7 loc) • 2.35 kB
{ "version": 3, "sources": ["src/platform/specs/OneSwiftHostNativeComponent.ts"], "sourcesContent": ["// the device host for a react native `.swift` import: the package's registered\n// view, or one of its typed views, rendered with the importing element's props\n// as json text. a typed view reports each callback call back as an event.\nimport type { ViewProps } from 'react-native';\nimport type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\ntype SwiftHostEvent = Readonly<{\n name: string;\n args: string;\n}>;\ninterface NativeProps extends ViewProps {\n packageName: string;\n // a typed view's struct name, or empty for the package's @main view\n view: string;\n contractHash: string;\n props: string;\n // a whole swift app: fill the space yoga gives instead of measuring content\n fill: boolean;\n onHostEvent?: DirectEventHandler<SwiftHostEvent>;\n}\nconst NativeComponentRegistry = require('react-native/Libraries/NativeComponent/NativeComponentRegistry');\nconst {\n ConditionallyIgnoredEventHandlers\n} = require('react-native/Libraries/NativeComponent/ViewConfigIgnore');\nlet nativeComponentName = 'OneSwiftHost';\nexport const __INTERNAL_VIEW_CONFIG = {\n uiViewClassName: \"OneSwiftHost\",\n directEventTypes: {\n topHostEvent: {\n registrationName: \"onHostEvent\"\n }\n },\n validAttributes: {\n packageName: true,\n view: true,\n contractHash: true,\n props: true,\n fill: true,\n ...ConditionallyIgnoredEventHandlers({\n onHostEvent: true\n })\n }\n};\nexport default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);"], "mappings": "AAoBA,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,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,MAAM;AAAA,IACN,cAAc;AAAA,IACd,OAAO;AAAA,IACP,MAAM;AAAA,IACN,GAAGF,EAAkC;AAAA,MACnC,aAAa;AAAA,IACf,CAAC;AAAA,EACH;AACF;AACA,IAAOG,IAAQJ,EAAwB,IAAIE,GAAqB,MAAMC,CAAsB;", "names": ["NativeComponentRegistry", "ConditionallyIgnoredEventHandlers", "nativeComponentName", "__INTERNAL_VIEW_CONFIG", "OneSwiftHostNativeComponent_default"] }