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

Button component in content prop #165

Open
ziabskiK opened this issue Jul 7, 2020 · 8 comments
Open

Button component in content prop #165

ziabskiK opened this issue Jul 7, 2020 · 8 comments
Assignees

Comments

@ziabskiK
Copy link

ziabskiK commented Jul 7, 2020

How is it possible to trigger onClick function on button which is located as a content of swipe element?

Any tip how to achieve this?

Thanks in advance.
Edit Code:
{({ className, ...rest }) => (

<SwipeableListItem key={id}
swipeLeft={{
content: <Button startIcon={} className={classes.addToCartBtn}
onClick={e => {
e.stopPropagation();
console.log('Test function call');
}}>
Add to cart
,
actionAnimation: ActionAnimations.NONE
}}
{...rest}>
///items

))}

@marekrozmus
Copy link

I assume you want to achieve the iphone functionality like showing few buttons after swipe?

It looks like you can so far do the thing you've mentioned above with the swipeRight prop. It currently does not work for the 'left' content as it is rendered 'under' the right content.
So a little fix would need to be done to not only change the opacity of the swipe content items but also the display style.

Let me know if this is needed and try if you can achieve the behavior you need with the swipeRight prop.

@marekrozmus marekrozmus self-assigned this Jul 11, 2020
@marekrozmus
Copy link

@all-contributors please add @ziabskiK for bug

@allcontributors
Copy link
Contributor

@marekrozmus

I've put up a pull request to add @ziabskiK! 🎉

@marekrozmus
Copy link

We have checked this issue and current architecture does not allow this. We will monitor this issue and get back to you if more users will be interested in such a feature. Most probably, a huge rewrite is needed to support your request as the inner node layout and positioning is pretty complicated.

@Ex0-Ghost
Copy link

Ex0-Ghost commented Dec 1, 2020

well i searched everywhere for that functionality that you mention , when you swipe it reveals the content behind and stays like that for you to click on a button, like here , i don't want to use react-native-web just for that

@marekrozmus
Copy link

Hi, I'll try to make another try hopefully this weekend. Will let you know. 🙂

@derwaldgeist
Copy link

derwaldgeist commented Jan 4, 2021

I would also love to see this feature. We're trying to mimic the behavior of a native swipeable iOS listview as much as possible, but this would require buttons that are revealed if you just swipe a bit (but not beyond a certain threshold). react-swipe-to-delete-ios supports this, but it has other issues (like rubber-banding of the enclosing web-page).

@marekrozmus
Copy link

marekrozmus commented Feb 6, 2021

@derwaldgeist, @Ex0-Ghost Please check this one and leave some comments there :) I have reimplemented all from scratch so still might have some issues.
https://github.com/marekrozmus/react-swipeable-list

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

4 participants