UNPKG

@scrolia/react-native

Version:
1 lines 1.57 kB
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/components/provider/index.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport type { Format } from \"ts-vista\";\n\nimport type { Options } from \"#/@types/options\";\nimport type { ScrollCoreStates } from \"#/contexts/scrollcore\";\n\nimport { ScrollCoreContext, useScrollCoreStates } from \"#/contexts/scrollcore\";\n\n/** Props for the `Provider` component. */\ntype ProviderProps = Format<\n Options & {\n children?: React.ReactNode;\n }\n>;\n\n/** Provider component. */\nconst Provider = (props: ProviderProps): React.JSX.Element => {\n const { children, ...p } = props;\n\n const x: ScrollCoreStates = useScrollCoreStates();\n const y: ScrollCoreStates = useScrollCoreStates();\n\n return (\n <ScrollCoreContext\n value={{\n options: {\n ...p,\n disabled: p.disabled ?? false,\n animated: p.animated ?? false,\n plugins: p.plugins ?? [],\n },\n x,\n y,\n }}\n >\n {children}\n </ScrollCoreContext>\n );\n};\n\nexport type { ProviderProps };\nexport { Provider };\n"],"mappings":";;;;;;AAkBA,MAAM,YAAY,UAA4C;CAC1D,MAAM,EAAE,UAAU,GAAG,MAAM;CAE3B,MAAM,IAAsB,qBAAqB;CACjD,MAAM,IAAsB,qBAAqB;AAEjD,QACI,oBAAC,mBAAD;EACI,OAAO;GACH,SAAS;IACL,GAAG;IACH,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,WAAW,EAAE;IAC3B;GACD;GACA;GACH;EAEA;EACe"}