react-native-reanimated
Version:
More powerful alternative to Animated library for React Native.
35 lines (27 loc) • 812 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getRelativeCoords = getRelativeCoords;
exports.isSharedValue = isSharedValue;
var _NativeMethods = require("./NativeMethods");
/**
* Given an absolute position and a component ref, returns the relative
* position in the component's local coordinate space.
*/
function getRelativeCoords(parentRef, absoluteX, absoluteY) {
'worklet';
const parentCoords = (0, _NativeMethods.measure)(parentRef);
if (parentCoords === null) {
return null;
}
return {
x: absoluteX - parentCoords.x,
y: absoluteY - parentCoords.y
};
}
function isSharedValue(value) {
'worklet';
return (value === null || value === void 0 ? void 0 : value._isReanimatedSharedValue) === true;
}
//# sourceMappingURL=utils.js.map