react-native-sortables
Version:
Powerful Sortable Components for Flexible Content Reordering in React Native
23 lines (22 loc) • 590 B
JavaScript
;
import { useDerivedValue } from 'react-native-reanimated';
import { useCommonValuesContext } from '../CommonValuesProvider';
export default function useItemZIndex(key, activationAnimationProgress) {
const {
activeItemKey,
prevActiveItemKey
} = useCommonValuesContext();
return useDerivedValue(() => {
if (activeItemKey.value === key) {
return 3;
}
if (prevActiveItemKey.value === key) {
return 2;
}
if (activationAnimationProgress.value > 0) {
return 1;
}
return 0;
});
}
//# sourceMappingURL=useItemZIndex.js.map