反应原生中的onmouseenter事件 [英] onmouseenter event in react native
问题描述
'onmouseenter' 在本机反应中是否有等效的事件.我已经尝试过平移响应器和可滑动
Is there a equivalent event in react native for 'onmouseenter'. I have already tried pan responder and swipe-able
我想检测用户在屏幕上滑动时是否进入并离开了组件.
I want to detect if the user while swiping around a screen enters a component and leaves it.
推荐答案
我用很多代码实现了 onMouseEnter 的行为,简而言之,实现了一个圆形 View 作为手指触摸屏幕位置的指示器,并实现了指示器圆圈和你想要 onMouseEnter 的组件之间的碰撞检测.
I implemented the behavior of onMouseEnter with many code, in short, implemented a circle View as an indicator of the position where your finger touch the screen, and implemented the collision detection between the indicator circle and the component which you want onMouseEnter.
要计算指标圈的pickerX和pickerY,可以参考https://github.com/flyskywhy/react-native-bitmap-color-picker/blob/master/index.js
To compute pickerX and pickerY of the indicator circle, you can ref to what PanResponder did in https://github.com/flyskywhy/react-native-bitmap-color-picker/blob/master/index.js
要计算碰撞检测,您可以参考 areOverlapping = distanceBetweenCenters <;https://dev.to/hrastnik/implementing-gravity-and-collision-detection-in-react-native-2hk5
To compute collision detection, you can ref to areOverlapping = distanceBetweenCenters < circleDiameter
in https://dev.to/hrastnik/implementing-gravity-and-collision-detection-in-react-native-2hk5
这篇关于反应原生中的onmouseenter事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!