Skip to content

Unable to update original position #144

@AnsonSavage

Description

@AnsonSavage

I think this may be related to this issue: #89 . I am also seeing if there is any feedback on StackOverflow.

By setting the shouldReverse prop to true, the draggable item smoothly returns to its original position.

However, I can't seem to dynamically update the "original position" of the draggable item by updating the position.x and position.y values, as in the following code:

    <View style={styles.answerContainer}>
        {answerParts.map((item, index) => (
            <Draggable
                key={item.index}
                x={item.position.x}
                y={item.position.y}
                disabled={item.placed}
                shouldReverse={!item.placed}
                onDragRelease={(event) => onReleaseItem(item, event)}
            >
                <View style={styles.draggableItem}>
                    <Text style={styles.draggableText}>{item.text}</Text>
                </View>
            </Draggable>
        ))}
    </View>

Any thoughts on how I can properly change the original location of a draggable React Native component?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions