Skip to content
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

return final animation values to JS when animation completes (#36731) #37782

Closed
wants to merge 1 commit into from

Conversation

genkikondo
Copy link
Contributor

Summary:

When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the Pressability responder region/tap target is incorrect

This diff:

  • Returning the final values from the native side, at the same place it sets the "finished" flag. This gets sent to JS in animated/animations/Animation.js. In this diff I'm passing the value when 'hasFinishedAnimations' is true, but in a follow up diff I will look into other cases such as cancelled animations

Next:
2. Update the Animated.Value to reflect the new values
3. Call the onEnd function if there is one set
4. Use setNativeProps to pass the new values down for layout calculations and the correct Pressability responder region

Changelog:
[General][Changed] - return animated values to JS for natively driven animations

Reviewed By: javache

Differential Revision: D44110833

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Jun 8, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44110833

…k#37782)

Summary:
Pull Request resolved: facebook#37782

Pull Request resolved: facebook#36731

When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the Pressability responder region/tap target is incorrect

**This diff:**
- Returning the final values from the native side, at the same place it sets the "finished" flag. This gets sent to JS in `animated/animations/Animation.js`. In this diff I'm passing the value when 'hasFinishedAnimations' is true, but in a follow up diff I will look into other cases such as cancelled animations

Next:
2. Update the Animated.Value to reflect the new values
3. Call the onEnd function if there is one set
4. Pass the new values down for layout calculations and the correct Pressability responder region

Changelog:
[General][Changed] - return animated values to JS for natively driven animations

Reviewed By: javache

Differential Revision: D44110833

fbshipit-source-id: 8f8b8a6c92ae32a1b12d9b28843d21b2116bb42b
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D44110833

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,744,636 +33
android hermes armeabi-v7a 8,056,812 +32
android hermes x86 9,235,720 +39
android hermes x86_64 9,086,572 +37
android jsc arm64-v8a 9,307,345 -32
android jsc armeabi-v7a 8,496,848 -45
android jsc x86 9,369,294 -43
android jsc x86_64 9,624,249 -37

Base commit: 108309e
Branch: main

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jun 8, 2023
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 4b54c0b.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants