Skip to content

Error on AnimatedValue.js file when it tries to call flush #25210

@iagormoraes

Description

@iagormoraes

The AnimatedValue.js throws an error on line 58 when node.__getChildren().forEach(findAnimatedStyles); is called on _flush function sometimes.

React Native version: 0.58.3

Steps To Reproduce

1 - create variable with Animated.Value
2 - update the value

Describe what you expected to happen:
Animations work properly.

Snack, code example, or link to a repository:

The error happens in node_modules/react-native/Libraries/Animated/src/nodes/AnimatedValue.js in findAnimatedStyles at line 58:28:

function _flush(rootNode: AnimatedValue): void {
  const animatedStyles = new Set();
  function findAnimatedStyles(node) {
    /* $FlowFixMe(>=0.68.0 site=react_native_fb) This comment suppresses an
     * error found when Flow v0.68 was deployed. To see the error delete this
     * comment and run Flow. */
    if (typeof node.update === 'function') {
      animatedStyles.add(node);
    } else {
      node.__getChildren().forEach(findAnimatedStyles);
    }
  }
  findAnimatedStyles(rootNode);
  /* $FlowFixMe */
  animatedStyles.forEach(animatedStyle => animatedStyle.update());
}

Throws TypeError: s.__getChildren().forEach is not a function. (In 's.__getChildren().forEach(t)', 's.__getChildren().forEach' is undefined)

Error screenshot:

Screen Shot 2019-06-10 at 09 21 26

Metadata

Metadata

Assignees

No one assigned

    Labels

    API: AnimatedBugFlowStaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions