Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Fix incorrect useAnimatedValue usage in Animated documentation

已關閉 適合新手
#5,263 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@Simek 已經在處理了。

開始於 2026年10月6日。

  • #5264 來自 @Simek —— 未關閉

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
85/100
Issue 類型
文件
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
react-native
領域
documentation

研究方向

在 react-native-website 儲存庫中找出 Animated API 文件頁面,找到錯誤匯入並使用 useAnimatedValue 的程式碼範例,將 useAnimatedValue(0) 替換為 new Animated.Value(0),並移除未使用的 useAnimatedValue 匯入,接著確認範例執行時不會發生回報的執行階段錯誤。

由索引模型根據 Issue 內容生成。

描述

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

主要語言
MDX
星號
2.2k
分支
6.4k
平均合併
13 小時 6 分鐘
30 天內合併 PR
28

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

react/react-native-website 的其他 Issue

查看 react/react-native-website 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。