Skip to content

Commit

Permalink
Merge pull request #5252 from GeekyAnts/fix/action-content-state
Browse files Browse the repository at this point in the history
fix/action-content-state
  • Loading branch information
surajahmed authored Aug 17, 2022
2 parents ece46ce + bdf803e commit 0d45a16
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/composites/Actionsheet/ActionsheetContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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, {
Expand Down

0 comments on commit 0d45a16

Please sign in to comment.