Positions And Animation
The library ships with built-in modal placements through MODAL_POSITIONS.
import { MODAL_POSITIONS } from 'react-motion-modal';
Available positions
MODAL_POSITIONS.TOP;
MODAL_POSITIONS.TOP_LEFT;
MODAL_POSITIONS.TOP_RIGHT;
MODAL_POSITIONS.TOP_CENTER;
MODAL_POSITIONS.LEFT;
MODAL_POSITIONS.RIGHT;
MODAL_POSITIONS.CENTER;
MODAL_POSITIONS.CENTER_FULL;
MODAL_POSITIONS.BOTTOM;
MODAL_POSITIONS.BOTTOM_LEFT;
MODAL_POSITIONS.BOTTOM_RIGHT;
MODAL_POSITIONS.BOTTOM_CENTER;
Default motion behavior
When you do not pass a custom animate prop, body motion follows the selected position:
LEFTslides from the leftRIGHTslides from the rightTOPandTOP_CENTERslide from aboveBOTTOMandBOTTOM_CENTERslide from below- corner positions slide diagonally
CENTERfades and scales inCENTER_FULLfades in without the scale effect
Overriding animation
Pass animate on openModal if you need a custom motion spec:
modalStore.getState().openModal('AlertModal', {
animate: {
animate: { opacity: 1, y: 0 },
exit: { opacity: 0, y: 24 },
},
});
Passing animate disables the built-in body animation preset for that modal.