Skip to content

Commit

Permalink
Draggable: add clarifying inline comment after the recent hook depend…
Browse files Browse the repository at this point in the history
…ency changes (WordPress#41658)
  • Loading branch information
ciampo authored and jhnstn committed Jun 15, 2022
1 parent fb7ccc4 commit 7cfe82a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/components/src/draggable/index.native.js
Original file line number Diff line number Diff line change
@@ -134,7 +134,16 @@ const Draggable = ( { children, onDragEnd, onDragOver, onDragStart } ) => {

const providerValue = useMemo( () => {
return { panGestureRef, isDragging, isPanActive, draggingId };
}, [ isDragging, isPanActive, draggingId ] );
}, [
// `isDragging`, `isPanActive` and `draggingId` are created using the
// `useSharedValue` hook provided by the `react-native-reanimated`, which in
// theory should guarantee that the value of these variables remains stable.
// ESLint can't pick this up, and that's why they have to be specified as
// dependencies for this hook call.
isDragging,
isPanActive,
draggingId,
] );

return (
<GestureDetector gesture={ panGesture }>

0 comments on commit 7cfe82a

Please sign in to comment.