I am using draggable component as described in Draggable Example
My parent component will pass default/initial position to draggable component as props.
How to set default/initial position for draggable component?
Hi, @HeinZawHtet
Frankly speaking, I'm not really get your issue. Animated.View's style has translate field where we could pass gesture interaction like here:
<Animated.View
style={[
styles.box,
{
transform: [
{ translateX: this._translateX },
{ translateY: this._translateY },
],
},
]}
/>
However, you can still set left or top in style in order to get proper initial position. What's more you could set an offset this values (e.g. this._translateY.setOffset(123)) or do it like: { translateY: Animated.add(this._translateY, 123) }, if you wish to handle it "manually"
I'm not really into setting initial props as it's not matter of gesture handling but processing their results
I suppose your issue has been fixed. If not, please let us know
Most helpful comment
Hi, @HeinZawHtet
Frankly speaking, I'm not really get your issue.
Animated.View's style has translate field where we could pass gesture interaction like here:However, you can still set
leftortopinstylein order to get proper initial position. What's more you could set an offset this values (e.g.this._translateY.setOffset(123)) or do it like:{ translateY: Animated.add(this._translateY, 123) },if you wish to handle it "manually"I'm not really into setting initial props as it's not matter of gesture handling but processing their results