-
Notifications
You must be signed in to change notification settings - Fork 23
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
swiping the chart cause InteractionManager.runAfterInteractions not called #81
Comments
由于我使用图表只用于显示作用,直接用透明 |
pie图单指滑动就会有这个错误吗?还是需要来开debug才会有? |
修改后能运行的地方是? |
只要是滑动就会有这个问题,不一定要开 debug, 我修改 |
修改了这个文件的代码 react-native-echarts/src/components/PanResponderHandler.tsx Lines 39 to 111 in 8ecce6c
把这里
改成了下面的这样(只是简单的把 const panResponder = useRef(PanResponder.create({
onStartShouldSetPanResponder: () => true,
onStartShouldSetPanResponderCapture: () => true,
onMoveShouldSetPanResponder: () => true,
onMoveShouldSetPanResponderCapture: () => true,
onPanResponderGrant: _ref2 => {
let {
nativeEvent
} = _ref2;
dispatchEvents(['mousedown', 'mousemove'], nativeEvent);
},
onPanResponderMove: _ref3 => {
let {
nativeEvent
} = _ref3;
const touches = nativeEvent.touches;
const length = touches.length;
if (length === 1) {
if (!moving || zooming) {
setMoving(true);
setZooming(false);
} else {
dispatchEvents(['mousemove'], nativeEvent);
}
} else if (length === 2) {
const [{
locationX: x0,
locationY: y0
}, {
locationX: x1,
locationY: y1
}] = touches;
const distance = calcDistance(x0, y0, x1, y1);
const {
x,
y
} = calcCenter(x0, y0, x1, y1);
if (!zooming) {
pan.current = {
initialX: x,
initialY: y,
prevDistance: distance
};
setZooming(true);
} else {
const {
initialX,
initialY,
prevDistance
} = pan.current;
const delta = distance - prevDistance;
pan.current.prevDistance = distance;
dispatchEvents(['mousewheel'], nativeEvent, {
zrX: initialX,
zrY: initialY,
zrDelta: delta / 120
});
}
}
},
onPanResponderTerminationRequest: () => true,
onPanResponderRelease: _ref4 => {
let {
nativeEvent
} = _ref4;
if (!zooming) {
dispatchEvents(['mouseup', 'click'], nativeEvent);
}
setMoving(false);
setZooming(false);
},
onPanResponderTerminate: () => {},
onShouldBlockNativeResponder: () => {
return false;
}
})).current; |
handleGesture={false}可禁用手势 |
try @wuba/react-native-echarts@1.2.2-alpha.0 |
@zhiqingchen 你好,经过这边调试,确系是下面这个函数的问题 react-native-echarts/src/components/PanResponderHandler.tsx Lines 39 to 111 in 8ecce6c
由于创建 下面是在 解决方案:把下面 react-native-echarts/src/components/PanResponderHandler.tsx Lines 42 to 43 in 8ecce6c
更改后的打印日志信息: 这样就可以正常 |
是这个原因 |
经过测试没有问题了,感谢! |
Describe the bug
滑动图表导致
InteractionManager.runAfterInteractions
回调未调用To Reproduce
Steps to reproduce the behavior:
/node_modules/react-native/Libraries/Interaction/InteractionManager.js
修改DEBUG
变量值为const DEBUG: true = true;
为了打开InteractionManager
日志输出;SVGRenderer
创建一个PieChart
图表;InteractionManager: create interaction handle
, 并未见InteractionManager: clear interaction handle
.InteractionManager
未清除interaction handle
, 所以导致之后所有InteractionManager.runAfterInteractions
都不会执行回调;Expected behavior
InteractionManager.runAfterInteractions
回调正常调用Screenshots
react-native-echarts/src/components/PanResponderHandler.tsx
Desktop (please complete the following information):
yarn react-native info
Smartphone (please complete the following information):
Additional context
"@wuba/react-native-echarts": "^1.2.1"
The text was updated successfully, but these errors were encountered: