Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/components/DraggableFlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
activeCellSize,
activeIndexAnim,
containerSize,
scrollInit,
scrollOffset,
scrollViewSize,
spacerIndexAnim,
Expand All @@ -85,6 +86,7 @@ function DraggableFlatListInner<T>(props: DraggableFlatListProps<T>) {
touchTranslate.value = 0;
activeCellSize.value = -1;
activeCellOffset.value = -1;
scrollInit.value = -1;
setActiveKey(null);
});

Expand Down
7 changes: 5 additions & 2 deletions src/context/animatedValueContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function useSetupAnimatedValues<T>() {
const activeCellOffset = useSharedValue(0); // Distance between active cell and edge of container

const scrollOffset = useSharedValue(0);
const scrollInit = useSharedValue(0);
const scrollInit = useSharedValue(-1);

const viewableIndexMin = useSharedValue(0);
const viewableIndexMax = useSharedValue(0);
Expand Down Expand Up @@ -90,7 +90,8 @@ function useSetupAnimatedValues<T>() {
}, []);

const autoScrollDistance = useDerivedValue(() => {
if (!isDraggingCell.value) return 0;
const scrollInitIsNotSet = scrollInit.value === -1;
if (!isDraggingCell.value || scrollInitIsNotSet) return 0;
const innerScrollDiff = scrollOffset.value - scrollInit.value;
// If list is nested there may be an outer scroll diff
const outerScrollDiff = outerScrollOffset.value - outerScrollInit.value;
Expand Down Expand Up @@ -173,6 +174,7 @@ function useSetupAnimatedValues<T>() {
panGestureState,
placeholderOffset,
resetTouchedCell,
scrollInit,
scrollOffset,
scrollViewSize,
spacerIndexAnim,
Expand All @@ -196,6 +198,7 @@ function useSetupAnimatedValues<T>() {
panGestureState,
placeholderOffset,
resetTouchedCell,
scrollInit,
scrollOffset,
scrollViewSize,
spacerIndexAnim,
Expand Down