UNPKG

@nexara/nativeflow

Version:

Beautiful, responsive, and customizable UI components for React Native – built for performance and seamless experiences.

27 lines (25 loc) 897 B
"use strict"; const positionCalculations = (anchorLayoutRef, menuLayoutRef, placement) => { let positionValues = { top: 0, bottom: 0, left: 0, right: 0 }; if (anchorLayoutRef.pageX < menuLayoutRef.width) { positionValues.left = anchorLayoutRef.pageX + anchorLayoutRef.width; } else { positionValues.left = anchorLayoutRef.pageX - menuLayoutRef.width; } // else if (anchorLayoutRef.current.pageX + menuLayoutRef.current.width > SCREEN_WIDTH) { // positionValues.left = anchorLayoutRef.current.pageX - menuLayoutRef.current.width; // } if (placement === 'top') { positionValues.top = anchorLayoutRef.pageY; } else if (placement === 'bottom') { positionValues.top = anchorLayoutRef.pageY - menuLayoutRef.height + anchorLayoutRef.height; } return positionValues; }; export { positionCalculations }; //# sourceMappingURL=calculations.js.map