Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16750

React-Native: Get X and Y coordinates of draggable Object using panResponder.panHandlers (nativeElement)

$
0
0

I am developing an app, which provides the design of Different shapes like Square and Circle, I have used the following Library

https://www.npmjs.com/package/react-native-draggable
At the time of creating my drawing view its working fine, but at the time of edit that drawing, I want to move Circle and Square from its previous saved position to its new position, but when I am trying to set my previous last position from the DB, I can't get perfect position of X and Y.enter image description here

When I debug, I am getting touch position of the object, not the X and Y position of the object

this is my code :

  1. I used draggable class for creating an object Draggable,

  2. In my Component :

    <Draggable                       renderSize={68}                       renderColor='rad'                       x={80.80097961425781}                       y={72.79156494140625}                       renderText='B'                       pressDrag={()=>alert('touched!!')}                       pressDragRelease={({ nativeEvent }) => { console.log(nativeEvent);}}                       reverse={false}                   />

Here is my Question:
1. How can I get X and Y from nativeElement,
'nativeElement` property are : nativeEvent

ChangedTouches - Array of all touch events that have changed since the last eventidentifier - The ID of the touchlocationX - The X position of the touch, relative to the elementlocationY - The Y position of the touch, relative to the elementpageX - The X position of the touch, relative to the root elementpageY - The Y position of the touch, relative to the root elementtarget - The node id of the element receiving the touch eventtimestamp - A time identifier for the touch, useful for velocity calculationtouches - Array of all current touches on the screen

Viewing all articles
Browse latest Browse all 16750

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>