-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NativeAnimated] Support the Slow Animations
option of the iOS simulator
#21157
Conversation
cc @kmagiera Could be nice to integrate this in reanimated too. |
41b409a
to
2410685
Compare
Including a video in your test plan would be cool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sweet, I have wanted this for so long. Would be nice if there was a single point you could tweak, rather than hacking the math in all the animation types separately, but probably not worth refactoring for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sahrens is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
@janicduplessis merged commit 40bcc38 into Once this commit is added to a release, you will see the corresponding version tag below the description at 40bcc38. If the commit has a single |
@janicduplessis: we're seeing animated test failures after merging this - any idea why that could be? e.g. RCTNativeAnimatedNodesManagerTests/testSpringAnimationLoop: RCTNativeAnimatedNodesManagerTests/testAnimationCallbackFinish: |
CGFloat RCTAnimationDragCoefficient() | ||
{ | ||
#if TARGET_IPHONE_SIMULATOR | ||
return (CGFloat)UIAnimationDragCoefficient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on this POP code, maybe we need to guard against 0 for some reason?
/~https://github.com/facebook/pop/blob/master/pop/POPAnimationExtras.mm#L37
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. For some reason the value is 10 when testing...I'll fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that's strange. Thanks for investigating this!
…1157) Summary: RN animations currently ignore the `Slow Animations` option on the iOS simulator because we don't use UIKit animations directly. This uses a private api to get the slow coefficient and use it in the native animated driver. We only compile the private api code on simulator so this won't cause issues for app store approval. One possible issue is that the api changes in new iOS versions but I think it's reasonable to do this. Note that this won't work with JS driven animations, we could expose the slow coefficient as a constant and use that in JS but I decided not to implement it. Pull Request resolved: facebook#21157 Differential Revision: D9980306 Pulled By: sahrens fbshipit-source-id: bdbce2e469261a75cb4b9a251e8e8f212bb9c4e7
RN animations currently ignore the
Slow Animations
option on the iOS simulator because we don't use UIKit animations directly. This uses a private api to get the slow coefficient and use it in the native animated driver. We only compile the private api code on simulator so this won't cause issues for app store approval. One possible issue is that the api changes in new iOS versions but I think it's reasonable to do this.Note that this won't work with JS driven animations, we could expose the slow coefficient as a constant and use that in JS but I decided not to implement it.
Test Plan:
Tested that animations are properly slowed like native UIKit ones in RNTester native animated example.
Release Notes:
[IOS] [ENHANCEMENT] [NativeAnimated] - Support the
Slow Animations
option of the iOS simulator