mediasfu-reactnative
Version:
MediaSFU Prebuilt React Native SDK
33 lines • 1.29 kB
JavaScript
/**
* Gets the style for positioning a modal based on the specified position.
*
* @param {GetModalPositionOptions} options - Configuration options specifying the modal position.
* @returns {ModalPositionStyle} - The style object for positioning the modal.
*
* @example
* ```typescript
* const centerStyle = getModalPosition({ position: "center" });
* console.log(centerStyle);
* // Output: { justifyContent: "center", alignItems: "center" }
*
* const topLeftStyle = getModalPosition({ position: "topLeft" });
* console.log(topLeftStyle);
* // Output: { justifyContent: "flex-start", alignItems: "flex-start" }
* ```
*/
export const getModalPosition = ({ position }) => {
switch (position) {
case 'center':
return { justifyContent: 'center', alignItems: 'center' };
case 'topLeft':
return { justifyContent: 'flex-start', alignItems: 'flex-start' };
case 'topRight':
return { justifyContent: 'flex-start', alignItems: 'flex-end' };
case 'bottomLeft':
return { justifyContent: 'flex-end', alignItems: 'flex-start' };
case 'bottomRight':
default:
return { justifyContent: 'flex-end', alignItems: 'flex-end' };
}
};
//# sourceMappingURL=getModalPosition.js.map