Swipeable - How to prevent auto closing after executing onSwipeableOpen #2464
-
I am using Swipeable component for "swipe to select" functionality in the mobile app I am working on. I have a list of invoices. Each invoice is swipeable. When user swipe right, it displays selected checkbox in the left menu and invoice number should be added to Current Behaviour Expected Behaviour InvoicesList.tsx component
Document.tsx component
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
After small break to refresh my brain and then couple of hours further digging I found the root cause and the solution. Swipeable component actually has not been getting closed after It's because I've been using
Solution was to use
|
Beta Was this translation helpful? Give feedback.
After small break to refresh my brain and then couple of hours further digging I found the root cause and the solution.
Swipeable component actually has not been getting closed after
onSwipeableOpen
execution. It looked like it's been getting closed as the component was re-rendered after updatingselectedInvoices
state.It's because I've been using
useState
hook, then updating state is always causing re-render.