Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.

Calling setState with scroll scrollEnabled argument prevents the swipeoutButtons from opening #327

Open
Lelelo1 opened this issue Mar 26, 2019 · 1 comment

Comments

@Lelelo1
Copy link

Lelelo1 commented Mar 26, 2019

<Swipeout right={this.renderSwipeoutButtons} buttonsWidth={44} scroll={(scrollEnabled) => { this.setState({ scrollEnable }); }} > </Swipeout>

This causes the flatlist to rerender all the items - preventing them from being opened. How to solve it?

@martakielpinska
Copy link

Instead of setting state on your entire screen/component, set the "native prop" of the list. This fixed the issue for me. You need to add ref prop to your flatList first.

this.myFlatList.setNativeProps({scrollEnabled: true/false})

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants