react-native-sortables
Version:
Powerful Sortable Components for Flexible Content Reordering in React Native
39 lines (36 loc) • 1.19 kB
JavaScript
;
import { useSharedValue } from 'react-native-reanimated';
import { DragActivationState } from '../../types';
import { createProvider } from '../utils';
const {
ActiveItemValuesProvider,
useActiveItemValuesContext
} = createProvider('ActiveItemValues')(() => {
// POSITIONS
const touchPosition = useSharedValue(null);
const activeItemPosition = useSharedValue(null);
// DIMENSIONS
const activeItemDimensions = useSharedValue(null);
// DRAG STATE
const activeItemKey = useSharedValue(null);
const prevActiveItemKey = useSharedValue(null);
const activationState = useSharedValue(DragActivationState.INACTIVE);
const activeAnimationProgress = useSharedValue(0);
const inactiveAnimationProgress = useSharedValue(0);
const activeItemDropped = useSharedValue(true);
return {
value: {
activationState,
activeAnimationProgress,
activeItemDimensions,
activeItemDropped,
activeItemKey,
activeItemPosition,
inactiveAnimationProgress,
prevActiveItemKey,
touchPosition
}
};
});
export { ActiveItemValuesProvider, useActiveItemValuesContext };
//# sourceMappingURL=ActiveItemValuesProvider.js.map