Fix incorrect useAnimatedValue usage in Animated documentation
Maintainer thường phản hồi trong vòng 1 ngày
Đá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.
- 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
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của react/react-native-website
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
react/react-native-website#5258 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docs: distinguish Fast Refresh effect reruns from Strict Mode checksCó thể đã có người làm @walitemuri đã nhận 23 ngày trước. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
react/react-native-website#5217 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Integration with Existing Apps: Podfile example does not use `use_react_native!`, is incompleteCó thể đã có người làm @mhjacobson đã nhận 1701 ngày trước. Đang mở👋 Good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
react/react-native-website#2958 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
react/react-native-website#5259 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
react/react-native-website#5216 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của react/react-native-website
Issue tương tự
-
changelog investigate
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ramnes/notion-sdk-py#408 ·
-
triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
github/docs#46222 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 72/100
peteonrails/voxtype#844 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement priority:low ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add a mail symbolĐang mởenhancement good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100