Skip to content

[docs] Replace useRef with useAnimatedValue in Animated example#4984

Merged
Simek merged 2 commits intofacebook:mainfrom
lunaleaps:fix/animated-docs-useAnimatedValue
Feb 12, 2026
Merged

[docs] Replace useRef with useAnimatedValue in Animated example#4984
Simek merged 2 commits intofacebook:mainfrom
lunaleaps:fix/animated-docs-useAnimatedValue

Conversation

@lunaleaps
Copy link
Contributor

@lunaleaps lunaleaps commented Feb 12, 2026

Summary

  • The Animated docs example was reading ref.current during render (useRef(new Animated.Value(0)).current), which violates React's rules for refs
  • Replaced with useAnimatedValue(0), which is the hook React Native provides for this use case and is already referenced elsewhere in the same doc

Test plan

  • Validated the example code doesn't trigger any Flow errors

The example was reading ref.current during render, which violates
React's rules for refs. Use useAnimatedValue instead, which is the
hook React Native provides for this use case.
@netlify
Copy link

netlify bot commented Feb 12, 2026

Deploy Preview for react-native ready!

Name Link
🔨 Latest commit 5dfdd96
🔍 Latest deploy log https://app.netlify.com/projects/react-native/deploys/698e1595523418000862f94a
😎 Deploy Preview https://deploy-preview-4984--react-native.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@lunaleaps lunaleaps requested a review from Simek February 12, 2026 19:00
Copy link
Collaborator

@Simek Simek left a comment

Choose a reason for hiding this comment

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

Thanks for the update @lunaleaps! 🙏

@Simek Simek merged commit 11153d7 into facebook:main Feb 12, 2026
5 checks passed
@lunaleaps lunaleaps deleted the fix/animated-docs-useAnimatedValue branch February 12, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants