@scrolia/react-native
Version:
A headless scrollbar component
1 lines • 1.3 kB
Source Map (JSON)
{"version":3,"file":"index.mjs","names":[],"sources":["../../../src/hooks/thumb/index.ts"],"sourcesContent":["import type { PanResponderInstance } from \"react-native\";\n\nimport type { Axis } from \"#/@types/options\";\n\nimport * as React from \"react\";\n\nimport { createPanResponder } from \"#/hooks/thumb/functions/pan\";\n\nconst createThumbHandler = (axis: Axis) => {\n const _panResponder: PanResponderInstance = createPanResponder(axis);\n\n const panResponder: PanResponderInstance =\n React.useRef<PanResponderInstance>(_panResponder).current;\n\n return {\n panResponder,\n };\n};\n\n/** Hook for thumb logic. */\nconst useThumbXHandler = () => createThumbHandler(\"x\");\n\n/** Hook for thumb logic. */\nconst useThumbYHandler = () => createThumbHandler(\"y\");\n\n/** Result of the `useThumbXHandler` hook. */\ntype ThumbXHandler = ReturnType<typeof useThumbXHandler>;\n\n/** Result of the `useThumbYHandler` hook. */\ntype ThumbYHandler = ReturnType<typeof useThumbYHandler>;\n\nexport type { ThumbXHandler, ThumbYHandler };\nexport { useThumbXHandler, useThumbYHandler };\n"],"mappings":";;;AAQA,MAAM,sBAAsB,SAAe;CACvC,MAAM,gBAAsC,mBAAmB,KAAK;AAKpE,QAAO,EACH,cAHA,MAAM,OAA6B,cAAc,CAAC,SAIrD;;;AAIL,MAAM,yBAAyB,mBAAmB,IAAI;;AAGtD,MAAM,yBAAyB,mBAAmB,IAAI"}