Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swipe width not recalculated after left or right buttons change #133

Open
ermannos opened this issue Nov 5, 2019 · 0 comments
Open

Swipe width not recalculated after left or right buttons change #133

ermannos opened this issue Nov 5, 2019 · 0 comments

Comments

@ermannos
Copy link

ermannos commented Nov 5, 2019

If the property left (or right) changes his value, the width of the swipe movement doesn't get recalculated.

If for example the left property contains 2 buttons, the width is calculated in the componentDidMount method with an initial value. After a change in the left property it has now 4 button, but the swipe width is still the initial one (when it should be much more). The result is that the two new buttons are only partially visible or not visible al all.
The same happens with the right property.
I only verified this problem in the browser, not in native version of the Swipeout component.

To solve this problem simply add a componentDidUpdate like this:

componentDidUpdate() {
    this.btnsLeftWidth = this.left ? this.left.offsetWidth : 0;
    this.btnsRightWidth = this.right ? this.right.offsetWidth : 0;
}

Thanks

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

No branches or pull requests

1 participant