Page MenuHomePhabricator

[native] Move componentDidUpdate logic in MultimediaMessageMultimedia to functional component
ClosedPublic

Authored by angelika on Wed, Dec 11, 12:35 PM.
Tags
None
Referenced Files
F3506572: D14134.diff
Fri, Dec 20, 5:21 PM
F3506462: D14134.id46527.diff
Fri, Dec 20, 4:35 PM
F3506082: D14134.id46428.diff
Fri, Dec 20, 3:34 PM
F3506042: D14134.id46528.diff
Fri, Dec 20, 3:32 PM
F3505610: D14134.id46353.diff
Fri, Dec 20, 2:02 PM
F3504850: D14134.id46353.diff
Fri, Dec 20, 10:48 AM
F3504592: D14134.id46491.diff
Fri, Dec 20, 9:35 AM
F3498945: D14134.id.diff
Thu, Dec 19, 9:57 PM
Subscribers
None

Details

Summary

Move the logic in componentDidUpdate to a functional component, that is: if the scroll in overlay context is now disabled and it wasn't disabled before, then call setClickable(true). Or in more human way: if a modal that was previously blocking scroll etc. disappeared then the message with the multimedia is clickable again.

Depends on D14133

Test Plan

Open a modal (a tooltip or click a message with an image)
Close a modal
Click on a message with an image
Verify the image is expanded

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

angelika held this revision as a draft.

Accepting so I don't block you, but please make sure you've considered whether there's any risks associated with this effect potentially being run on mount

native/chat/multimedia-message-multimedia.react.js
205–212 ↗(On Diff #46353)

Will this effect run on mount? I noticed in the old class component, there is no componentDidMount, so technically the behavior may be different if this effect can run on mount. Even if the effect runs on mount, there might be no problem... just wondering if you've thought about this

This revision is now accepted and ready to land.Wed, Dec 11, 8:10 PM

Rebase and address feedback

native/chat/multimedia-message-multimedia.react.js
205–212 ↗(On Diff #46353)

The effect will run on mount, but scrollWasDisabled will be undefined so props.setClickable won't be called. All it does on the first render is setting scrollWasDisabled.

native/chat/multimedia-message-multimedia.react.js
205–212 ↗(On Diff #46353)

Thanks for the analysis!