Files
status-react/src/js/worklets/bottom_sheet.js
T
Rahul Pratap c80992b6bf Update prettier config for the project. (#16303)
* Update prettier config for the project.

* Add prettier to make lint-fix.
2023-06-19 19:09:12 +05:30

16 lines
570 B
JavaScript

import { useDerivedValue, runOnJS as reaRunOnJS, runOnJS } from 'react-native-reanimated';
export function useTranslateY(initialTranslationY, bottomSheetDy, panY) {
return useDerivedValue(() => {
return initialTranslationY - (bottomSheetDy.value - panY.value);
});
}
export function useBackgroundOpacity(translateY, backgroundHeight, windowHeight, opacity) {
return useDerivedValue(() => {
const calculatedOpacity = ((translateY.value - windowHeight) / -backgroundHeight) * opacity;
return Math.max(Math.min(calculatedOpacity, opacity), 0);
});
}