@scrolia/react-native-reanimated
Version:
A set of reanimated components for Scrolia React Native
1 lines • 2.05 kB
Source Map (JSON)
{"version":3,"file":"y.mjs","names":["p: ReanimatedTrackYProps"],"sources":["../../src/track/y.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ViewProps } from \"react-native\";\n\nimport { useScrollCore } from \"@scrolia/react-native/contexts/scrollcore\";\nimport { getComponentProps } from \"@scrolia/react-native/functions/props\";\nimport * as React from \"react\";\nimport { View } from \"react-native\";\nimport Reanimated from \"react-native-reanimated\";\n\n/** Props for the `ReanimatedTrackY` component. */\ntype ReanimatedTrackYProps = ViewProps & {\n ref?: React.Ref<View>;\n};\n\n/**\n * Vertical track component based on `react-native-reanimated`.\n *\n * **This component requires `react-native-reanimated` to be installed.**\n */\nconst ReanimatedTrackY = (props: ReanimatedTrackYProps): React.JSX.Element => {\n const {\n options: { disabled, animated, plugins },\n y: { setHvTrack },\n } = useScrollCore();\n\n const p: ReanimatedTrackYProps = 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 <Reanimated.View\n {...p}\n ref={p.ref}\n >\n {p.children}\n </Reanimated.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 { ReanimatedTrackYProps };\nexport { ReanimatedTrackY };\n"],"mappings":";;;;;;;;;;;;;;AAoBA,MAAM,oBAAoB,UAAoD;CAC1E,MAAM,EACF,SAAS,EAAE,UAAU,UAAU,WAC/B,GAAG,EAAE,iBACL,eAAe;CAEnB,MAAMA,IAA2B,kBAAkB;EAC/C,MAAM;EACN;EACA;EACH,CAAC;AAEF,OAAM,gBAAsB;AACxB,aAAW,KAAK;IACjB,CACC,WACH,CAAC;AAEF,KAAI,SAAU,QAAO,iCAAO;AAE5B,KAAI,SACA,QACI,oBAAC,WAAW;EACR,GAAI;EACJ,KAAK,EAAE;YAEN,EAAE;GACW;AAI1B,QACI,oBAAC;EACG,GAAI;EACJ,KAAK,EAAE;YAEN,EAAE;GACA"}