@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":"x.mjs","names":["p: ReanimatedTrackXProps"],"sources":["../../src/track/x.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 `ReanimatedTrackX` component. */\ntype ReanimatedTrackXProps = ViewProps & {\n ref?: React.Ref<View>;\n};\n\n/**\n * Horizontal track component based on `react-native-reanimated`.\n *\n * **This component requires `react-native-reanimated` to be installed.**\n */\nconst ReanimatedTrackX = (props: ReanimatedTrackXProps): React.JSX.Element => {\n const {\n options: { disabled, animated, plugins },\n x: { setHvTrack },\n } = useScrollCore();\n\n const p: ReanimatedTrackXProps = 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 <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 { ReanimatedTrackXProps };\nexport { ReanimatedTrackX };\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"}