Skip to content

On Animated.loop, when resetBeforeIteration is false with Animated.sequence, it causes an error after the one cycle #37611

@zipperdev

Description

@zipperdev

Description

When repeating the animation, I set the resetBeforeIteration property to false
so that it doesn't reset to its initial value when another cycle starts.
But after the first cycle and before the second cycle started,
I got an error ERROR TypeError: Cannot read property 'start' of undefined, js engine: hermes.

화면 기록 2023-05-29 오전 10 38 50

Just in case, I change another option iteration but it didn't cause the error.

React Native Version

0.71.8

Output of npx react-native info

System:
    OS: macOS 13.4
    CPU: (8) arm64 Apple M1 Pro
    Memory: 73.05 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.1.0 - /opt/homebrew/bin/node
    Yarn: Not Found
    npm: 9.6.7 - /opt/homebrew/bin/npm
    Watchman: 2023.05.08.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK:
      API Levels: 30, 31, 33
      Build Tools: 29.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-31 | ARM 64 v8a, android-31 | Google APIs ARM 64 v8a
      Android NDK: 21.4.7075529
  IDEs:
    Android Studio: Flamingo 2022.2.1 Patch 1 Flamingo 2022.2.1 Patch 1
    Xcode: 14.3/14E222b - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.7 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.8 => 0.71.8 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

On Animated.loop, put Animated.sequence in the animation param, and add an option resetBeforeIteration to false.

Snack, code example, screenshot, or link to a repository

const POS = useRef(new Animated.ValueXY({ x: 0, y: 0 })).current;

Animated.loop(
    Animated.sequence([
        Animated.timing(POS, {
            toValue: {
                x: 100,
                y: 100,
            },
            useNativeDriver: false,
        }),
        Animated.timing(POS, {
            toValue: {
                x: -100,
                y: -100,
            },
            useNativeDriver: false,
        }),
    ]),
    {
        resetBeforeIteration: false,
    }
).start();

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: AnimatedNeeds: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions