Struggling to center a modal with transition using Material UI and facing challenges with responsiveness on small screens, particularly mobile devices.
The modal looks good and is centered on smaller screens if no transition is used. However, when a transition is added, the modal loses its centered position and responsiveness.
Here is the code for the modal without transition: link. It works well on both large and small screens.
And here is the code for the modal with transition: link.
I've attempted adjusting the values of top
and left
, but have not been successful in centering the modal on both large and small screens:
function getModalStyle() {
const top = 25;
const left = 25;
return {
top: `${top}%`,
left: `${left}%`,
transform: `translate(-${top}%, -${left}%)`,
};
}
Can anyone offer assistance?