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 for native driven animations #36731

Closed
wants to merge 1 commit into from

Conversation

skinsshark
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][Internal] - return animated values to JS for natively driven animations

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 Mar 30, 2023
@facebook-github-bot
Copy link
Contributor

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

@skinsshark skinsshark changed the title return final animation values to JS when animation completes return final animation values to JS for native driven animations Mar 30, 2023
@analysis-bot
Copy link

analysis-bot commented Mar 30, 2023

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 8,568,214 -2
android hermes armeabi-v7a 7,882,600 +1
android hermes x86 9,050,121 -4
android hermes x86_64 8,905,166 -7
android jsc arm64-v8a 9,166,653 -6
android jsc armeabi-v7a 8,357,072 +10
android jsc x86 9,223,336 +14
android jsc x86_64 9,481,181 +3

Base commit: ed448b5
Branch: main

…k#36731)

Summary:
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. 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

Differential Revision: D44110833

fbshipit-source-id: 3418aed9ae724d33dcedb0e678a7e5b4c89ca65e
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

Hi @skinsshark!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

genkikondo added a commit to genkikondo/react-native that referenced this pull request Jun 8, 2023
…k#36731)

Summary:
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. 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

fbshipit-source-id: 3a2a24b5184836450beb5dc698db01253fe91437
genkikondo added a commit to genkikondo/react-native that referenced this pull request Jun 8, 2023
…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 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