@scrolia/react-native
Version:
A headless scrollbar component
1 lines • 1.76 kB
Source Map (JSON)
{"version":3,"file":"y.mjs","names":[],"sources":["../../../src/components/track/y.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 `TrackY` component. */\ntype TrackYProps = ViewProps & {\n ref?: React.Ref<View>;\n};\n\n/** Vertical track component. */\nconst TrackY = (props: TrackYProps): React.JSX.Element => {\n const {\n options: { disabled, animated, plugins },\n x: { setHvTrack },\n } = useScrollCore();\n\n const p: TrackYProps = getComponentProps({\n name: \"trackY\",\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 { TrackYProps };\nexport { TrackY };\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"}