Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zipperdev opened this issue May 29, 2023 · 1 comment
Labels
API: Animated Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@zipperdev
Copy link

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();
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Nov 25, 2023
@github-actions github-actions bot closed this as completed Dec 2, 2023
facebook-github-bot pushed a commit that referenced this issue May 28, 2024
Summary:
Currently, if the `Animated.sequence` animation is finished, and then the `start()` method is called without a `reset()` method being invoked beforehand, the failure happens: ```undefined is not an object (evaluating 'animations[current].start')```.
Use cases:
- sequence animation started, finished, and then started again
- sequence animation is used in `Animation.loop` with `resetBeforeIteration` set to `false`, which essentially does the same as the previous case

Related issues:
- #43120
- #37611

## Changelog:

[General] [Fixed] - Fix sequence restart failure

Pull Request resolved: #44031

Test Plan: Test cases are included: 1 for regression and 2 for mentioned use cases in the summary

Reviewed By: cipolleschi

Differential Revision: D56015346

Pulled By: dmytrorykun

fbshipit-source-id: 8b0f46c8a33397fece807634463ce630c89d28af
kosmydel pushed a commit to kosmydel/react-native that referenced this issue Jun 11, 2024
Summary:
Currently, if the `Animated.sequence` animation is finished, and then the `start()` method is called without a `reset()` method being invoked beforehand, the failure happens: ```undefined is not an object (evaluating 'animations[current].start')```.
Use cases:
- sequence animation started, finished, and then started again
- sequence animation is used in `Animation.loop` with `resetBeforeIteration` set to `false`, which essentially does the same as the previous case

Related issues:
- facebook#43120
- facebook#37611

## Changelog:

[General] [Fixed] - Fix sequence restart failure

Pull Request resolved: facebook#44031

Test Plan: Test cases are included: 1 for regression and 2 for mentioned use cases in the summary

Reviewed By: cipolleschi

Differential Revision: D56015346

Pulled By: dmytrorykun

fbshipit-source-id: 8b0f46c8a33397fece807634463ce630c89d28af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API: Animated Needs: Triage 🔍 Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

1 participant