UNPKG

@scrolia/react-native

Version:
1 lines 1.76 kB
{"version":3,"file":"x.mjs","names":[],"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,UAAU,UAA0C;CACtD,MAAM,EACF,SAAS,EAAE,UAAU,UAAU,WAC/B,GAAG,EAAE,iBACL,eAAe;CAEnB,MAAM,IAAiB,kBAAkB;EACrC,MAAM;EACN;EACA;EACH,CAAC;AAEF,OAAM,gBAAsB;AACxB,aAAW,KAAK;IACjB,CACC,WACH,CAAC;AAEF,KAAI,SAAU,QAAO,gCAAO;AAE5B,KAAI,SACA,QACI,oBAAC,SAAS,MAAV;EACI,GAAI;EACJ,KAAK,EAAE;YAEN,EAAE;EACS;AAIxB,QACI,oBAAC,MAAD;EACI,GAAI;EACJ,KAAK,EAAE;YAEN,EAAE;EACA"}