[Glitch] Show media modal on public timeline

Port e0b1e17bd0 to glitch-soc
This commit is contained in:
Thibaut Girka
2018-07-31 23:03:16 +02:00
parent 5cd7fe21bf
commit d2b3eebe00
3 changed files with 22 additions and 3 deletions

View File

@ -44,6 +44,17 @@ export default class ModalRoot extends React.PureComponent {
onClose: PropTypes.func.isRequired,
};
getSnapshotBeforeUpdate () {
const visible = !!this.props.type;
return {
overflowY: visible ? 'hidden' : null,
};
}
componentDidUpdate (prevProps, prevState, { overflowY }) {
document.body.style.overflowY = overflowY;
}
renderLoading = modalId => () => {
return ['MEDIA', 'VIDEO', 'BOOST', 'FAVOURITE', 'DOODLE', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
}