Anton Bogomolov
Anton Bogomolov

Reputation: 129

Drag and drop from ScrollView React Native

I want to split the screen in two for a drag and drop list. When I use a View it works fine. But I have to use ScrollView as second column has multiplay content.

How do I overlay Dropitem from ScrollView to View?

Snack https://snack.expo.io/@sitenative/two-columns-drag

enter image description here

Upvotes: 3

Views: 1897

Answers (1)

dianaqqq
dianaqqq

Reputation: 668

Even if this might not answer your question, I found a kind of solution/workaround for your issue which maybe is useful to you. I moved the style from the scrollView style prop to contentContainerStyle, and basically used the space that remained from the whole scrollView as the view where the items will be dropped.

  <SafeAreaView style={styles.container}>
                <ScrollView
                    style={{backgroundColor: 'brown'}}
                    scrollEnabled={this.state.scroll}
                    contentContainerStyle={styles.drag}
                    showsVerticalScrollIndicator={false}
                    disableScrollViewPanResponder={true}
                    nestedScrollEnabled={true}
                >
                    {sheet.map((object, i) =>
                        <DragItem
                            key={'top_'+i}
                            color={object.color}
                            first={!i}
                            name={object.name}
                            scrollUpdate={this.scrollUpdate}
                        />
                    )}
                </ScrollView>
            </SafeAreaView>

Upvotes: 1

Related Questions