react-native-reanimated
Version:
More powerful alternative to Animated library for React Native.
23 lines (21 loc) • 645 B
JavaScript
import { measure } from './NativeMethods';
/**
* Given an absolute position and a component ref, returns the relative
* position in the component's local coordinate space.
*/
export function getRelativeCoords(parentAnimatedRef, absoluteX, absoluteY) {
'worklet';
const parentCoords = measure(parentAnimatedRef);
if (parentCoords === null) {
return null;
}
return {
x: absoluteX - parentCoords.x,
y: absoluteY - parentCoords.y
};
}
export function isSharedValue(value) {
'worklet';
return (value === null || value === void 0 ? void 0 : value._isReanimatedSharedValue) === true;
}
//# sourceMappingURL=utils.js.map