UNPKG

@scrolia/react-native

Version:
1 lines 1.42 kB
{"version":3,"file":"index.mjs","names":["axis: Axis","_panResponder: PanResponderInstance","panResponder: PanResponderInstance"],"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,qBAAqB,CAACA,SAAe;CACvC,MAAMC,gBAAsC,mBAAmB,KAAK;CAEpE,MAAMC,eACF,MAAM,OAA6B,cAAc,CAAC;AAEtD,QAAO,EACH,aACH;AACJ;;AAGD,MAAM,mBAAmB,MAAM,mBAAmB,IAAI;;AAGtD,MAAM,mBAAmB,MAAM,mBAAmB,IAAI"}