react-native-gesture-handler icon indicating copy to clipboard operation
react-native-gesture-handler copied to clipboard

Default/Initial position for Draggable Component

Open heinafk opened this issue 8 years ago • 2 comments

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?

heinafk avatar Jun 09 '18 16:06 heinafk

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

osdnk avatar Jun 11 '18 11:06 osdnk

I suppose your issue has been fixed. If not, please let us know

osdnk avatar Jun 14 '18 08:06 osdnk