react-native-reorderable-list
Version:
Reorderable list for React Native applications, powered by Reanimated
15 lines • 494 B
JavaScript
import { useAnimatedReaction } from 'react-native-reanimated';
import { useContext } from './useContext';
import { ReorderableCellContext } from '../contexts';
export const useReorderableDragStart = onStart => {
const {
draggedIndex,
index
} = useContext(ReorderableCellContext);
useAnimatedReaction(() => draggedIndex.value === index, newValue => {
if (newValue && onStart) {
onStart(index);
}
}, [onStart]);
};
//# sourceMappingURL=useReorderableDragStart.js.map