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

Upgrade reanimated #5200

Merged
merged 13 commits into from Mar 5, 2024
Merged

Upgrade reanimated #5200

merged 13 commits into from Mar 5, 2024

Conversation

christianbaroni
Copy link
Member

@christianbaroni christianbaroni commented Nov 22, 2023

What changed (plus any additional context for devs)

  • Upgrades reanimated to v3.7.1 for stability improvements/crash fixes

This PR also patches reanimated with this change to REANodesManager.mm (this only affects iOS):

-  _displayLink.preferredFramesPerSecond = 120; // will fallback to 60 fps for devices without Pro Motion display

+  if (@available(iOS 15.0, *)) {
+    _displayLink.preferredFrameRateRange = CAFrameRateRangeMake(80, 120, 80);
+  } else {
+    _displayLink.preferredFramesPerSecond = 120; // will fallback to 60 fps for devices without Pro Motion display
+  }

Docs: https://developer.apple.com/documentation/quartzcore/cadisplaylink/3875343-preferredframeraterange

I suspect the request for 120fps is being rejected, so instead this requests a range of 80-120fps, with a preferred frame rate of 80fps — any higher than 80fps resulted in a lower frame rate (40-60fps), presumably because the request was rejected.

The consequence of this change is that animations run at ~80fps on Pro Motion devices instead of fluctuating between 40-60fps.

What to test

  • Animations/gestures throughout the app

I suspect the request for 120fps is being rejected, so instead this requests a range of 80-120fps, with a preferred frame rate of 80fps — any higher than 80fps resulted in a lower frame rate, presumably because the request was rejected

This should improve frame rates for all animations throughout the app
Copy link
Member

@brunobar79 brunobar79 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@skylarbarrera skylarbarrera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@skylarbarrera skylarbarrera merged commit 040b928 into develop Mar 5, 2024
6 checks passed
@skylarbarrera skylarbarrera deleted the @christian/upgrade-reanimated branch March 5, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants