diff --git a/native/chat/multimedia-message-multimedia.react.js b/native/chat/multimedia-message-multimedia.react.js --- a/native/chat/multimedia-message-multimedia.react.js +++ b/native/chat/multimedia-message-multimedia.react.js @@ -67,27 +67,6 @@ }; class MultimediaMessageMultimedia extends React.PureComponent { - static getOverlayContext(props: Props): OverlayContextType { - const { overlayContext } = props; - invariant( - overlayContext, - 'MultimediaMessageMultimedia should have OverlayContext', - ); - return overlayContext; - } - - componentDidUpdate(prevProps: Props) { - const scrollIsDisabled = - MultimediaMessageMultimedia.getOverlayContext(this.props) - .scrollBlockingModalStatus !== 'closed'; - const scrollWasDisabled = - MultimediaMessageMultimedia.getOverlayContext(prevProps) - .scrollBlockingModalStatus !== 'closed'; - if (!scrollIsDisabled && scrollWasDisabled) { - this.props.setClickable(true); - } - } - render(): React.Node { const { mediaInfo, @@ -219,6 +198,17 @@ }; }); + const scrollWasDisabled = React.useRef(); + + React.useEffect(() => { + const scrollIsDisabled = + overlayContext.scrollBlockingModalStatus !== 'closed'; + if (!scrollIsDisabled && scrollWasDisabled.current) { + props.setClickable(true); + } + scrollWasDisabled.current = scrollIsDisabled; + }, [overlayContext.scrollBlockingModalStatus, props]); + return (