Closed XuHaoJun closed 8 years ago
I'm seeing this too (or a very similar problem) - if the Svg element is not positioned in the top-left corner of the screen, the touch coordinates are incorrect (both X and Y).
This can be demonstrated easily with the PanExample from this project's documentation - Just place it inside an absolutely positioned View then try moving the star around. As soon as you start moving the shape will jump down and to the right of your actual touch-point.
It jitters around a fair bit between the actual touch-point and the incorrect offset position, so it seems like sometimes the correct position is being reported.
Note that the code for RNSVGSvgView.java
has an obvious bug at line 120 but fixing it seems to make no difference to this problem.
export default TouchTest = () => {
return (
<View style={styles.root}>
<View style={styles.absolute}>
<PanExample />
</View>
</View>
)
}
const styles = StyleSheet.create({
root: {
flex:1,
position:'relative'
},
absolute:{
position:'absolute',
left:100,
top:100
}
})
Thanks - works perfectly!
I use PanResponder get gestureState.d{x|y}, but only x is right, y is wrong.
my drag example code: https://gist.github.com/XuHaoJun/427588890d8c57c99f94247471e9bda3