Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Fix incorrect useAnimatedValue usage in Animated documentation

Đang mở Phù hợp với người mới
#5,263 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@Simek đang làm issue này rồi.

Từ ngày 6/10/2026.

  • #5264 của @Simek — đang mở

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
85/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react-native
Lĩnh vực
documentation

Hướng nghiên cứu

Tìm trang tài liệu API Animated trong kho lưu trữ react-native-website, tìm ví dụ mã nhập và sử dụng useAnimatedValue không chính xác, thay useAnimatedValue(0) bằng new Animated.Value(0) và xóa phần nhập useAnimatedValue không được sử dụng, sau đó xác nhận ví dụ chạy mà không gặp lỗi thời gian chạy đã báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

The Animated documentation currently contains an incorrect code example that imports and uses useAnimatedValue from react-native.

The example fails at runtime because useAnimatedValue is not available from react-native in the version used by the documentation.

This PR fixes the example by replacing useAnimatedValue(0) with new Animated.Value(0) and removing useAnimatedValue from the imports.

What is the problem?

The example in the Animated documentation imports useAnimatedValue from react-native and uses it to initialize the animated value.

This results in a runtime error because useAnimatedValue is not available from react-native:

TypeError: (0, _reactNative.useAnimatedValue) is not a function

As a result, users following the official documentation are unable to run the example as provided.

How can we address it?

Replace useAnimatedValue(0) with new Animated.Value(0) and remove useAnimatedValue from the react-native imports.

No other changes to the example are required.

Why is it important?

The example is part of the official React Native documentation, so users may reasonably expect the code to work when copied directly into a project.

A runtime error in a basic Animated example can be particularly confusing for developers learning or getting started with React Native.

Who needs this?

This is relevant to developers using the React Native Animated API, especially developers learning React Native or following the official documentation examples.

When should this happen (use version numbers if needed)?

This should be fixed as soon as possible so that the Animated documentation provides a working example.

https://github.com/react/react-native-website/pull/5122

Ngôn ngữ chính
MDX
Star
2.2k
Fork
6.3k
Merge trung bình
15 giờ 31 phút
Pull request đã merge (30 ngày)
20

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của react/react-native-website

Tất cả issue của react/react-native-website

Issue tương tự

Thêm issue về Documentation

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.