UNPKG

@scrolia/react-native

Version:
1 lines 1.81 kB
{"version":3,"file":"x.mjs","names":["props: TrackXProps","p: TrackXProps"],"sources":["../../../src/components/track/x.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ViewProps } from \"react-native\";\n\nimport * as React from \"react\";\nimport { Animated, View } from \"react-native\";\n\nimport { useScrollCore } from \"#/contexts/scrollcore\";\nimport { getComponentProps } from \"#/functions/props\";\n\n/** Props for the `TrackX` component. */\ntype TrackXProps = ViewProps & {\n ref?: React.Ref<View>;\n};\n\n/** Horizontal track component. */\nconst TrackX = (props: TrackXProps): React.JSX.Element => {\n const {\n options: { disabled, animated, plugins },\n x: { setHvTrack },\n } = useScrollCore();\n\n const p: TrackXProps = getComponentProps({\n name: \"trackX\",\n props,\n plugins,\n });\n\n React.useEffect((): void => {\n setHvTrack(true);\n }, [\n setHvTrack,\n ]);\n\n if (disabled) return <>{}</>;\n\n if (animated) {\n return (\n <Animated.View\n {...p}\n ref={p.ref}\n >\n {p.children}\n </Animated.View>\n );\n }\n\n return (\n <View\n {...p}\n ref={p.ref}\n >\n {p.children}\n </View>\n );\n};\n\nexport type { TrackXProps };\nexport { TrackX };\n"],"mappings":";;;;;;;;;;AAgBA,MAAM,SAAS,CAACA,UAA0C;CACtD,MAAM,EACF,SAAS,EAAE,UAAU,UAAU,SAAS,EACxC,GAAG,EAAE,YAAY,EACpB,GAAG,eAAe;CAEnB,MAAMC,IAAiB,kBAAkB;EACrC,MAAM;EACN;EACA;CACH,EAAC;CAEF,MAAM,UAAU,MAAY;EACxB,WAAW,KAAK;CACnB,GAAE,CACC,UACH,EAAC;AAEF,KAAI,SAAU,yCAAc;AAE5B,KAAI,SACA,4BACK,SAAS;EACN,GAAI;EACJ,KAAK,EAAE;YAEN,EAAE;GACS;AAIxB,4BACK;EACG,GAAI;EACJ,KAAK,EAAE;YAEN,EAAE;GACA;AAEd"}