-
-
Notifications
You must be signed in to change notification settings - Fork 623
Description
Decision Table
- My issue does not look like “The HTML attribute 'xxx' is ignored” (unless we claim support for it)
- My issue does not look like “The HTML element
<yyy>
is not rendered”
Good Faith Declaration
- I have read the HELP document here: https://git.io/JBi6R
- I have read the CONTRIBUTING document here: https://git.io/JJ0Pg
- I have confirmed that this bug has not been reported yet
Description
When using jest.useFakeTimers()
in tests, RNRH logs a whole lot of warnings, even when only rendering the component once.
I've also found the root cause. When using the fake timers, Jest patches performance.now()
(among others). Crucially, it sets the return value to 0
by default (you can advance this value using jest.advanceTimersByTime()
and related utilities, but the default is 0
)
Unfortunately, RNRH also uses 0
as the default of the lastUpdate
ref (source). Therefore, on the very first render, RNRH thinks the previous render happened exactly 0ms ago, and prints a bunch of warnings!
I realize this is not really a "bug" per se, and definitely won't affect any end users. However, it might confuse other devs like it confused me, and the fix is probably quite simple.
React Native Information
System:
OS: macOS 14.2.1
CPU: (10) arm64 Apple M1 Pro
Memory: 1.43 GB / 32.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.13.1
path: /private/var/folders/fk/c9z1tyhj02nfdn9dz_71vjk80000gq/T/xfs-3bfe75a4/node
Yarn:
version: 3.2.3
path: /private/var/folders/fk/c9z1tyhj02nfdn9dz_71vjk80000gq/T/xfs-3bfe75a4/yarn
npm:
version: 10.5.2
path: ~/.local/state/fnm_multishells/1402_1720596864919/bin/npm
Watchman:
version: 2024.05.06.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.0
path: /Users/tuur/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9862592
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.9
path: /Users/tuur/.jenv/shims/javac
Ruby:
version: 3.0.6
path: /Users/tuur/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.14
wanted: 0.72.14
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
RNRH Version
6.3.4
Tested Platforms
- Android
- iOS
- Web
- MacOS
- Windows
Reproduction Platforms
- Android
- iOS
- Web
- MacOS
- Windows
Minimal, Reproducible Example
Additional Notes
No response