@attio/react-native-bottom-sheet-toolbox
Version:
15 lines (13 loc) • 481 B
JavaScript
;
import { useAnimatedReaction, useSharedValue } from "react-native-reanimated";
/**
* Returns a shared value of the last value of the provided shared value.
*/
export function useLastSharedValue(sharedValue) {
const lastSharedValue = useSharedValue(null);
useAnimatedReaction(() => sharedValue.get(), (_value, lastValue) => {
lastSharedValue.set(lastValue);
}, [sharedValue]);
return lastSharedValue;
}
//# sourceMappingURL=use-last-shared-value.js.map