代码之家  ›  专栏  ›  技术社区  ›  Webwoman

ReactJS Promise-\u this.setExitAnimation未定义

  •  0
  • Webwoman  · 技术社区  · 6 年前

    不过,请回复我:

    _this.setExitAnimation未定义 下面是我的代码片段:

    /***** HERE TRIGGER THE setAnimation's PROCESS THEN INJECT 
    UPDATED ANIATION IN COMPONENT *****/
    textAnimation=()=>{            
    
        // CALL THE PROMISE'S CHAIN
          this.setState({elementType:"text"}, 
            () => this.routeAnimationPosition
              .then((anim) => { 
                console.log("promise resolved: ", anim)
                // set new animations
            this.setState({firstLineAnimation:anim}, 
              () =>     console.log("after setState textAnimation: ", this.state.textAnimation)
              )
    {...}
    
    /***** HERE START THE PROMISE'S CHAIN TO UPDATE ANIMATION'S NAME *****/
    
    routeAnimationPosition= new Promise((resolve, reject)=>{ 
      console.log("in routeAnimationPosition")
      if(this.state.exitLoop){ 
        this.setExitAnimation.then((anim)=> resolve(anim)); 
      }else{ 
        this.setEnterAnimation.then((anim)=> resolve(anim));
      }  
    })
    
    setEnterAnimation=new Promise((resolve, reject)=>{ 
      console.log("in setEnterAnimation")
      if(this.state.elementType ==="text"){
        if(this.state.currentView % 2 === 0){ 
          this.setState({textAnimation:enterDownAnimation});
          resolve(enterDownAnimation);
    {...}
    

    我不知道怎么回事,我觉得我的动画制作过程是公平的, 任何暗示都很好,

    0 回复  |  直到 6 年前
    推荐文章