-
-
Notifications
You must be signed in to change notification settings - Fork 955
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
Returning Swipeable reference #2105
Conversation
The following code allows me to do the following two things: 1. Close any previously opened Swipeable views when one is opened ```` const openedRow = useRef(); function renderItem({item: payable, index, separators}) { return ( <Swipeable onSwipeableWillOpen={() => openedRow.current?.close()} // Close a previously opened row onSwipeableOpen={(_, swipeable) => (openedRow.current = swipeable)} // Keep a link to the currenlty ```` 2. Close a Swipeable view when it is being deleted. ```` renderRightActions={(_, __, swipeable) => { return ( <TouchableOpacity onPress={() => { swipeable.close(); // Close the Swipeable when the user presses the button ````
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! First of all, sorry for the delay, could you update formatting so it passes lint check?
Any updates on this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't noticed I can edit your PR, sorry for the delay.
## Description <!-- Description and motivation for this PR. Include 'Fixes #<number>' if this is fixing some issue. --> #2105 returned the Swipeable reference, but only for `renderRightActions`. This MR aims to return that same reference on `renderLeftActions` also. The use case is the same. ## Test plan <!-- Describe how did you test this change here. --> I've been using my fork on a few personal projects and it's working as expected.
Excuse me, isn't it ip you opened row 1 and close it, when you open it again, it will auto close? I'm facing this issue right now |
Description
The following code allows me to do the following two things:
Resolves this issue: #764
Test plan
Made these changes in my own app and used patch-package. It has been working fine for my needs.