one
Version:
One is a React framework for web, iOS, and Android apps.
8 lines (7 loc) • 4.48 kB
Source Map (JSON)
{
"version": 3,
"sources": ["src/platform/specs/OneNativePagerNativeComponent.ts"],
"sourcesContent": ["// owned uniform pager spec; independent of the SwiftUI catalog.\nimport type { HostComponent, ViewProps } from 'react-native';\nimport type { DirectEventHandler, Int32, Double, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';\nimport codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';\nimport codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';\nimport type * as React from 'react';\ninterface NativeProps extends ViewProps {\n initialPage?: WithDefault<Int32, 0>;\n scrollEnabled?: WithDefault<boolean, true>;\n orientation?: WithDefault<'horizontal' | 'vertical', 'horizontal'>;\n layoutDirection?: WithDefault<'ltr' | 'rtl', 'ltr'>;\n offscreenPageLimit?: WithDefault<Int32, -1>;\n pageMargin?: WithDefault<Double, 0>;\n overdrag?: WithDefault<boolean, false>;\n overScrollMode?: WithDefault<'auto' | 'always' | 'never', 'auto'>;\n keyboardDismissMode?: WithDefault<'none' | 'on-drag', 'none'>;\n onPageScroll?: DirectEventHandler<Readonly<{\n position: Int32;\n offset: Double;\n }>>;\n onPageSelected?: DirectEventHandler<Readonly<{\n position: Int32;\n }>>;\n onPageScrollStateChanged?: DirectEventHandler<Readonly<{\n pageScrollState: string;\n }>>;\n}\ninterface NativeCommands {\n setPage(viewRef: React.ElementRef<HostComponent<NativeProps>>, index: Int32): void;\n setPageWithoutAnimation(viewRef: React.ElementRef<HostComponent<NativeProps>>, index: Int32): void;\n setScrollEnabledImperatively(viewRef: React.ElementRef<HostComponent<NativeProps>>, enabled: 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 = 'OneNativePager';\nexport const __INTERNAL_VIEW_CONFIG = {\n uiViewClassName: \"OneNativePager\",\n directEventTypes: {\n topPageScroll: {\n registrationName: \"onPageScroll\"\n },\n topPageSelected: {\n registrationName: \"onPageSelected\"\n },\n topPageScrollStateChanged: {\n registrationName: \"onPageScrollStateChanged\"\n }\n },\n validAttributes: {\n initialPage: true,\n scrollEnabled: true,\n orientation: true,\n layoutDirection: true,\n offscreenPageLimit: true,\n pageMargin: true,\n overdrag: true,\n overScrollMode: true,\n keyboardDismissMode: true,\n ...ConditionallyIgnoredEventHandlers({\n onPageScroll: true,\n onPageSelected: true,\n onPageScrollStateChanged: true\n })\n }\n};\nexport default NativeComponentRegistry.get(nativeComponentName, () => __INTERNAL_VIEW_CONFIG);\nexport const Commands = {\n setPage(ref, index) {\n dispatchCommand(ref, \"setPage\", [index]);\n },\n setPageWithoutAnimation(ref, index) {\n dispatchCommand(ref, \"setPageWithoutAnimation\", [index]);\n },\n setScrollEnabledImperatively(ref, enabled) {\n dispatchCommand(ref, \"setScrollEnabledImperatively\", [enabled]);\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,eAAe;AAAA,MACb,kBAAkB;AAAA,IACpB;AAAA,IACA,iBAAiB;AAAA,MACf,kBAAkB;AAAA,IACpB;AAAA,IACA,2BAA2B;AAAA,MACzB,kBAAkB;AAAA,IACpB;AAAA,EACF;AAAA,EACA,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,eAAe;AAAA,IACf,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,oBAAoB;AAAA,IACpB,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,qBAAqB;AAAA,IACrB,GAAGH,EAAkC;AAAA,MACnC,cAAc;AAAA,MACd,gBAAgB;AAAA,MAChB,0BAA0B;AAAA,IAC5B,CAAC;AAAA,EACH;AACF;AACA,IAAOI,IAAQL,EAAwB,IAAIG,GAAqB,MAAMC,CAAsB;AACrF,MAAME,IAAW;AAAA,EACtB,QAAQC,GAAKC,GAAO;AAClB,IAAAN,EAAgBK,GAAK,WAAW,CAACC,CAAK,CAAC;AAAA,EACzC;AAAA,EACA,wBAAwBD,GAAKC,GAAO;AAClC,IAAAN,EAAgBK,GAAK,2BAA2B,CAACC,CAAK,CAAC;AAAA,EACzD;AAAA,EACA,6BAA6BD,GAAKE,GAAS;AACzC,IAAAP,EAAgBK,GAAK,gCAAgC,CAACE,CAAO,CAAC;AAAA,EAChE;AACF;",
"names": ["NativeComponentRegistry", "ConditionallyIgnoredEventHandlers", "dispatchCommand", "nativeComponentName", "__INTERNAL_VIEW_CONFIG", "OneNativePagerNativeComponent_default", "Commands", "ref", "index", "enabled"]
}