Details
Details
Verify the orientation is set correctly
Diff Detail
Diff Detail
- Repository
- rCOMM Comm
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
native/components/full-screen-view-modal.react.js | ||
---|---|---|
1244–1256 ↗ | (On Diff #47076) | I wonder if a single effect would be cleaner: React.useEffect(() => { if (isActive) { Orientation.unlockAllOrientations(); } else { Orientation.lockToPortrait(); } return () => { if (isActive) { Orientation.lockToPortrait(); }; }; }, [isActive]); |
native/components/full-screen-view-modal.react.js | ||
---|---|---|
1244–1256 ↗ | (On Diff #47076) | Arguably it could be even more simple: React.useEffect(() => { if (!isActive) { return undefined; } Orientation.unlockAllOrientations(); return () => { Orientation.lockToPortrait(); }; }, [isActive]); |
native/components/full-screen-view-modal.react.js | ||
---|---|---|
1242 ↗ | (On Diff #47076) | replaced with an invariant |
1244–1256 ↗ | (On Diff #47076) | We had similar discussions here and a couple of versions: https://phab.comm.dev/D14221 and we finally ended up with this version. In your version if isActive changes, the cleanup is run first then the effect and it's messy. In the version in the diff it's really clear:
|
1254 ↗ | (On Diff #47076) | It doesn't really matter, if isActive is false, then we had called lockToPortrait before and here we call it again. I don't see anything wrong with calling it twice in a row. |
native/components/full-screen-view-modal.react.js | ||
---|---|---|
1244–1256 ↗ | (On Diff #47076) |
Not sure I agree that it's messy, but I don't feel strongly |