-
Notifications
You must be signed in to change notification settings - Fork 25.1k
useWindowDimensions causes infinite re-rendering #26733
Copy link
Copy link
Closed
Labels
API: DimensionsBugStaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
Using useWindowDimensions causes the app to re-render infinitly.
I have no idea why.
I copied the source code to my app and used it without any issues.
Once I use the exported hook this issue resumes.
Running on android.
React Native version: 0.61.2
System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
Memory: 665.92 MB / 7.87 GB
Binaries:
Node: 8.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.17.3 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.10.1 - C:\Program Files\nodejs\npm.CMD
SDKs:
Android SDK:
Android NDK: 17.2.4988734
IDEs:
Android Studio: Version 3.5.0.0 AI-191.8026.42.35.5791312
Steps To Reproduce
- import
useWindowDimensions - use it inside a function component or custom hook
Describe what you expected to happen:
use the hook without any issues.
Snack, code example, screenshot, or link to a repository:
▶︎ 'Warning: Maximum update depth exceeded. This can happen when a component calls setState inside useEffect, but useEffect either doesn\'t have a dependency array, or one of the dependencies changes on every render.%s',
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
API: DimensionsBugStaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.