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

拖拽的时候如果速度快,就会发生数据错误 #26

Open
39499740 opened this issue May 17, 2018 · 6 comments
Open

拖拽的时候如果速度快,就会发生数据错误 #26

39499740 opened this issue May 17, 2018 · 6 comments

Comments

@39499740
Copy link

比如一排有4个按钮(按钮1 按钮2 按钮3 按钮4),第四个拖拽到第一个,如果慢慢来,没有任何问题,如果动作快一点,按钮1就没有了,4个按钮变成了(按钮4 按钮2 按钮3 按钮4)
不知道是哪里的BUG

@mf-fengsheng
Copy link

https://github.com/mf-fengsheng/react-native-smart-sortable-sudoku-grid
我在这里修复了这个bug

@39499740
Copy link
Author

@mf-fengsheng 怎么安装你这个?

@mf-fengsheng
Copy link

package.json里的
“react-native-smart-sortable-sudoku-grid“: "^1.0.5"
改写成
"react-native-smart-sortable-sudoku-grid": "mf-fengsheng/react-native-smart-sortable-sudoku-grid"

@39499740
Copy link
Author

39499740 commented Jul 4, 2018

@mf-fengsheng 不知道你那里有没有这样的情况,比如开始的时候上面只有一排,当我在上面添加元素,上面换行以后,点完成按钮上面又会变成一排

@zgatrying
Copy link

zgatrying commented Sep 12, 2018

源码Utils.js内以下部分的代码和注释是有误的。

            case right: //currentCellIndex > hoverCellIndex
                cellIndex = hoverCellIndex - i //for supporting remove cell logic
                animationType = leftTranslation
                break
            case left:  //currentCellIndex < hoverCellIndex
                cellIndex = hoverCellIndex
                animationType = rightTranslation
                break

改为

            case right: //currentCellIndex < hoverCellIndex
                cellIndex = hoverCellIndex - i 
                animationType = leftTranslation
                break
            case left:  //currentCellIndex > hoverCellIndex
                cellIndex = hoverCellIndex + i
                animationType = rightTranslation
                break

bug出现的原因:

拖动过快导致Math.abs(currentCellIndex-hoverIndex) > 1, 而currentCellIndex < hoverCellIndex时cellIndex值是固定的hoverIndex,问题就出在这里。即从第二个需要动作的cell开始,对应的component都成了hoverCell。

@M45ter
Copy link

M45ter commented May 24, 2019

@mf-fengsheng @zgatrying 外层套ScrollView时,进入编辑模式拖动问题比较多,有解决方案吗

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

No branches or pull requests

4 participants