react-native-zoom-toolkit
Version:
Smoothly zoom any image, video or component you want!
13 lines (10 loc) • 336 B
text/typescript
import { useSharedValue, type SharedValue } from 'react-native-reanimated';
import type { Vector } from '../types';
export const useVector = (
x: number,
y?: number
): Vector<SharedValue<number>> => {
const first = useSharedValue<number>(x);
const second = useSharedValue<number>(y ?? x);
return { x: first, y: second };
};