This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix useWindowDimensions firing continuously after dims change (#26008)
Summary: #25990 fixed the `forceUpdate` method to actually update the component, but caused the useEffect to fire on every render, causing continuous updates after dimensions changed (e.g. from rotation). This reworks things a bit to be a bit simpler and more idiomatic so it's not quite as confusing, and fixes the bugs. ## Changelog [General] [Fixed] - Fix useWindowDimensions hook firing continuously after dimensions change Pull Request resolved: #26008 Test Plan: Aparently the Mobile Home app supports rotation on iOS now, so replaced it's content with the first `DimensionsExample` and confirmed with logging that `useEffect` fires exactly once, on initial mount, but the view still updates as expected when rotated: https://pxl.cl/Hfds Reviewed By: yungsters Differential Revision: D16765269 Pulled By: sahrens fbshipit-source-id: ef55d8a470dcfe87aa125d4c426bf01cfe0091a7
- Loading branch information
Showing 1 changed file with 12 additions and 14 deletions.