-
Notifications
You must be signed in to change notification settings - Fork 92
Description
I want to retrieve the coordinates of the draggable once it has been moved and write it to the store, so that once the app is closed, I can retrieve the coordinates to position the draggable where it was before the user closed the App.
Currently my draggable is inside a <View /> that hast 100% height and width.
<View
style={styles.container} >
<Draggable
x={0}
y={0}
z={7}
onDragRelease={(event, gestureState, bounds) => ??}
shouldReverse={false}
isCircle={true}
renderSize={90}>
<View
style={styles.wrapper}>
...
</View>
</Draggable>
</View >
const styles = StyleSheet.create({
container: {
zIndex: 2,
width: '100%',
height: '100%',
backgroundColor: 'red',
},
wrapper: {
zIndex: 998,
height: SIZE,
width: SIZE,
borderRadius: SIZE / 2,
borderWidth: 3,
borderColor: colors.touchables
},
});
Currently I am passing it the position x and y statically with 0. I need to pass it dynamically. I think onDragRelease() is the right method for this. But, whatever I pass it from gestureState, let it be moveX, x0, ... That is the wrong position for the draggable. After releasing the draggable, it jumps to a weird position, not where it was released. How would I retrieve the precise coordinates of the draggable, after is has been moved and released?