Skip to content

Animated.Value cannot have a listener attatched to it #4311

Open

Description

Environment

react-native-cli: 2.0.1
react-native: 0.61.5
System:
OS: Windows 10 10.0.18363
CPU: (12) x64 Intel(R) Xeon(R) W-2133 CPU @ 3.60GHz
Memory: 15.79 GB / 31.73 GB
Binaries:
Node: 10.16.3 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
npmPackages:
react: 16.9.0 => 16.9.0
react-native: ^0.61.5 => 0.61.5
react-native-windows: 0.61.0-beta.22 => 0.61.0-beta.44
Installed UWP SDKs:
10.0.17763.0
10.0.18362.0

Steps to Reproduce

const myAnimatedValue = useAnimatedValue(0);
myAnimatedValue.addListener(({value}) => console.log(value));

useEffect(() => {
  const animation = Animated.parallel([
    Animated.sequence([
      Animated.timing(myAnimatedValue, {
        toValue: 100,
        delay: 0,
        duration: 300,
        easing: Easing.linear,
        useNativeDriver: true,
      }),
    ]),
  ]);
animation.start();
}, []);

Expected Behavior

The console prints the value as it changes

Actual Behavior

Nothing happens

Additional context

Adam Gorman(adamgor)
Austin Beaulieu(aubeauli)

Activity

  1. ghost added
    Needs: Triage 🔍
    on Mar 13, 2020
  2. added
    Partner: Stream
    on Mar 16, 2020
  3. chrisglein commented on Mar 16, 2020

    @chrisglein
    Member

    Duplicate of #2941?

  4. chrisglein commented on Mar 19, 2020

    @chrisglein
    Member

    Duplicate of #2941

  5. removed
    Needs: Triage 🔍
    on Jul 20, 2020
  6. rozele commented on Mar 4, 2021

    @rozele
    Contributor

    I don't believe this is a dupe. The EventAnimationDriver hooks allows event driven animations (e.g., animations that subscribe to onScroll). This is asking for a different feature, which supports the example I referred to in #7277. Reopening.

    React.Native.Playground.Win32.2021-03-04.15-25-55.mp4
  7. ghost added
    Invalid Triage
    on Mar 5, 2021
  8. added and removed
    Invalid Triage
    on Aug 6, 2021
  9. 33 remaining items

  10. ghost closed this as completedin #9249on Nov 10, 2022
  11. ghost added a commit that references this issue on Nov 10, 2022
  12. rozele commented on Nov 11, 2022

    @rozele
    Contributor

    Re-opening, as this is technically still a bug for the composition-based NativeAnimated implementation and the tick-based implementation is opt-in.

    For a temporary workaround use:

    // Animated.timing is an example, same syntax for any animation driver
    Animated.timing({
      /* ... */,
      useNativeDriver: true,
      platformConfig: {
        useComposition: false,
      }
    );
    
  13. added
    Workstream: Component Parity
    on Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: AnimationPartner: FacebookPartner: StreamWorkstream: Component Paritybug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions