react / react/react-native

Animated - start animation callback is called immediately

未关闭
#43,271 5 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

API: Animated Issue: Author Provided Repro Newer Patch Available
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

When i call the "start()" method of Animated.timing the callback inside it is called immediately and not when the animation finish.

This is the code:

Animated.timing(positionY, {
    toValue: 100,
    duration: 500,
    useNativeDriver: false,
}).start(() => {
   hideMessage()
})
Steps to reproduce

I tried to reproduce the error on Expo online but on that playground the code works as expected. I also uploaded the video of the issue

React Native Version

0.73.5

Affected Platforms

Runtime - Android, Runtime - iOS

Output of npx react-native info
System:
  OS: macOS 14.3.1
  CPU: (12) x64 Apple M3 Pro
  Memory: 98.03 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: /usr/local/opt/node@18/bin/node
  Yarn:
    version: 1.22.21
    path: /usr/local/bin/yarn
  npm:
    version: 10.2.3
    path: /usr/local/opt/node@18/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.14.3
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.9
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.4
    wanted: 0.73.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
Stacktrace or Logs
My bug is not a crash.
Reproducer

https://snack.expo.dev/9vyz9rIza-lsKdo3usD2v

Screenshots and Videos

https://github.com/facebook/react-native/assets/15747776/3c4fa16c-9b8d-4697-8d56-0879c57597b2

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

Start with the Animated.timing().start() call in the provided reproducer and compare its behavior with the linked Expo Snack, where the callback reportedly works as expected. Reproduce the report on React Native 0.73.4/0.73.5 for Android and iOS, then verify that the callback runs only after the animation finishes.

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native
领域
mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。