-
Notifications
You must be signed in to change notification settings - Fork 25.1k
requestAnimationFrame returns Unix timestamp instead of elapsed time #16151
Copy link
Copy link
Closed
Labels
Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.Help Wanted
Issues ideal for external contributors.Issues ideal for external contributors.Issue: Author Provided ReproThis issue can be reproduced in Snack or an attached project.This issue can be reproduced in Snack or an attached project.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Metadata
Metadata
Assignees
Labels
Good first issueInterested in collaborating? Take a stab at fixing one of these issues.Interested in collaborating? Take a stab at fixing one of these issues.Help Wanted
Issues ideal for external contributors.Issues ideal for external contributors.Issue: Author Provided ReproThis issue can be reproduced in Snack or an attached project.This issue can be reproduced in Snack or an attached project.Resolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
OS: Linux 4.4
Node: 6.9.4
Yarn: Not Found
npm: 3.10.10
Watchman: Not Found
Packages: (wanted => installed)
react-native: 0.48.4 => 0.48.4
react: 16.0.0-alpha.12 => 16.0.0-alpha.12
Target Platform: Android 7 (SDK version 25)
Steps to Reproduce
Create a simple React component that invokes
requestAnimationFrameonce, stores the time parameter in state, and renders the result:Expected Behavior
The time parameter should be the time elapsed since the "page" "loaded" (navigated to current view or activity?) as is the case in Chrome and Firefox (this value should be
performance.now(), according to MDN.Actual Behavior
The time parameter resolves to the current Unix timestamp (i.e.
Date.now()).Reproducible Demo
https://github.com/jamesseanwright/react-native-requestanimationframe-bug
I'd be happy to submit a PR to fix this, but I'm unsure of how this project versions breaking changes. I can work around this issue, but it would be great to achieve parity with the browser API so that I can avoid platform-specific hacks.
Let me know your thoughts.
Cheers,
James