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

Taro处理拖动事件渲染的问题 #4156

Closed
xmh0511 opened this issue Aug 13, 2019 · 5 comments
Closed

Taro处理拖动事件渲染的问题 #4156

xmh0511 opened this issue Aug 13, 2019 · 5 comments
Labels
question Further information is requested

Comments

@xmh0511
Copy link

xmh0511 commented Aug 13, 2019

export default class Test extends Component{
     constroctor(props){
        super(props);
        this.state = {
           left:0,
           top:0
        }
     }

  Move(e){
   var touch = e.touches[0];
   this.setState({top:touch.clientY,left:touch.clientX});
 }

     render(){
         return (
           <View style={{position:"absolute",top:0,right:0,left:0,bottom:0}}>
             <View style={{backgroundColor:"red",left:`${this.state.left}px`,top:`${this.state.top}px`}} onTouchMove={this.Move.bind(this)}>
            </View>
          </View>
          )
      }
}

给View加了 拖拽处理时间,用React处理,行为是预期的,用Taro处理,拖动过程中会出现卡顿跳帧现象,初步估计 ,是由于Taro会合并多次setState造成拖拽过程中丢帧现象,希望官方能给出一个解决方案

@taro-bot
Copy link

taro-bot bot commented Aug 13, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@luckyadam
Copy link
Member

@luckyadam luckyadam added answered question Further information is requested labels Aug 13, 2019
@xmh0511
Copy link
Author

xmh0511 commented Aug 13, 2019

此处,我是想做一个自定义的悬浮按钮,用于快捷操作,movable-view的布局形式可能会和我当前的页面布局不兼容,有什么办法能够解决setState合并的问题吗或者说有其他的解决方案吗

@xmh0511
Copy link
Author

xmh0511 commented Aug 13, 2019

似乎h5也没有对MoveArea支持

@taro-bot
Copy link

taro-bot bot commented Aug 13, 2019

Hello~

您的问题楼上已经有了确切的回答,如果没有更多的问题这个 issue 将在 15 天后被自动关闭。

如果您在这 15 天中更新更多信息自动关闭的流程会自动取消,如有其他问题也可以发起新的 Issue。

Good luck and happy coding~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants