-
Notifications
You must be signed in to change notification settings - Fork 269
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
How to recentered "All swipeable" when user press/touch outside the swipeable container? #86
Comments
You can have the ref on each object that you have, and call // Object containing an index to each ref
swipeablesRef = Object.create(null);
// Set the ref somehow, for example:
if (!swipeablesRef[index]) swipeablesRef[index] = React.createRef();
<Swipeable ref={swipeablesRef[index]}>...</Swipeable>
// Call this when you need to recenter each swipeable
recenterAll = () => {
Object.values(swipeablesRef).filter(s => s.current).forEach(s => s.current.recenter());
}
// Call this when you delete one swipeable
deleteSwipeable = index => delete swipeablesRef[index]; |
It works for me. Thanks |
Working, nice! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have a Flatlist with Swipeable Item.
When I swipe one item, how to
recenter()
when I click anywhere on the Flatlist?The behavior is like "Clock" app in iOS
The text was updated successfully, but these errors were encountered: