From bdf803e77204f2bd8d27684476e2b1af55f84572 Mon Sep 17 00:00:00 2001 From: Viraj-10 Date: Mon, 8 Aug 2022 11:58:38 +0530 Subject: [PATCH] fix: actionsheet ondrag state fix --- .../composites/Actionsheet/ActionsheetContent.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/components/composites/Actionsheet/ActionsheetContent.tsx b/src/components/composites/Actionsheet/ActionsheetContent.tsx index 83508725c..8feb057bf 100644 --- a/src/components/composites/Actionsheet/ActionsheetContent.tsx +++ b/src/components/composites/Actionsheet/ActionsheetContent.tsx @@ -28,6 +28,16 @@ const Content = memo( ...resolvedProps } = usePropsResolution('ActionsheetContent', props); + const handleCloseRef = React.useRef(null); + const handleCloseCallback = React.useCallback(() => { + let handleCloseCurrent = handleCloseRef.current; + //@ts-ignore + return handleCloseCurrent(); + }, []); + React.useEffect(() => { + handleCloseRef.current = handleClose; + }, [handleClose]); + const panResponder = React.useRef( PanResponder.create({ onStartShouldSetPanResponder: () => true, @@ -48,7 +58,7 @@ const Content = memo( toValue: { x: 0, y: sheetHeight.current }, duration: 150, useNativeDriver: true, - }).start(handleClose); + }).start(handleCloseCallback); setTimeout(() => { Animated.timing(pan, {