function checkSetState(node) {
    const newState = _getStateUpdate(node);
    if (newState && newState.properties) {
      newState.properties.forEach(p => {
        const stateProperty = p.key && p.key.name;
        if (!stateProperty) {
          return;
        }
        const value = p.value;
        // If setting state to an animation directly, record the animation
        const isAnimation = astHelpers.isAnimationDeclaration(value.callee);
        if (isAnimation) {
          _updateAnimationRecord(node, stateProperty);
        } else if (p.value.type === "Identifier") {
          const allVariablesInScope = context.getScope().variables;
          allVariablesInScope.forEach(variable => {
            if (variable.name !== p.value.name) {
              return;
            }
            const isAnimatedState = _checkIsStateVariableAnimated(variable);
            if (isAnimatedState) {
              _updateAnimationRecord(node, stateProperty);
            }
          });
        }
      });
    }
  }
/**
   * Check setState calls. If state is set to an animated value directly,
   * we record the animation.
   */
Check setState calls. If state is set to an animated value directly,
we record the animation.
Check setState calls . If state is set to an animated value directly we record the animation .
function checkSetState(node) {
    const newState = _getStateUpdate(node);
    if (newState && newState.properties) {
      newState.properties.forEach(p => {
        const stateProperty = p.key && p.key.name;
        if (!stateProperty) {
          return;
        }
        const value = p.value;
        const isAnimation = astHelpers.isAnimationDeclaration(value.callee);
        if (isAnimation) {
          _updateAnimationRecord(node, stateProperty);
        } else if (p.value.type === "Identifier") {
          const allVariablesInScope = context.getScope().variables;
          allVariablesInScope.forEach(variable => {
            if (variable.name !== p.value.name) {
              return;
            }
            const isAnimatedState = _checkIsStateVariableAnimated(variable);
            if (isAnimatedState) {
              _updateAnimationRecord(node, stateProperty);
            }
          });
        }
      });
    }
  }
function checkSetState ( node ) { const newState = _getStateUpdate ( node ) ; if ( newState && newState . properties ) { newState . properties . forEach ( p => { const stateProperty = p . key && p . key . name ; if ( ! stateProperty ) { return ; } const value = p . value ; const isAnimation = astHelpers . isAnimationDeclaration ( value . callee ) ; if ( isAnimation ) { _updateAnimationRecord ( node , stateProperty ) ; } else if ( p . value . type === "Identifier" ) { const allVariablesInScope = context . getScope ( ) . variables ; allVariablesInScope . forEach ( variable => { if ( variable . name !== p . value . name ) { return ; } const isAnimatedState = _checkIsStateVariableAnimated ( variable ) ; if ( isAnimatedState ) { _updateAnimationRecord ( node , stateProperty ) ; } } ) ; } } ) ; } }
Check setState calls.
Check setState calls .
// If setting state to an animation directly, record the animation