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 click event not working #9

Open
esolzDotnet opened this issue Mar 14, 2018 · 2 comments
Open

Button click event not working #9

esolzDotnet opened this issue Mar 14, 2018 · 2 comments
Labels

Comments

@esolzDotnet
Copy link

I have placed a button inside the card.But the click event is not working.
what to do?

@robinmanuelthiel
Copy link
Owner

robinmanuelthiel commented Mar 15, 2018

Yeah, currently the control sucks all touch inputs to make the swiping work. It's quite dirty. You can take a look at it in the CardStackView.xaml.

<?xml version="1.0" encoding="UTF-8" ?>
<ContentView
    x:Class="SwipeCards.Controls.CardStackView"
    xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    Padding="20">

    <Grid>
        <RelativeLayout x:Name="CardStack" />

        <!--
            HACK: The TouchObserber is a terrible hack, so let me explain the problem
            On Android, Child elements observe touch events and don't pass them to the sender.
            So when attaching the PanGestureRecognizer to the parent view, it won't fire, when dragging the child.
            To fix this temporary, I added this transparent view on top of all others and attach the PanGestureRecognizer to it.
            A custom view renderer with an "IgnoreTouch" property might be a smarter solution...
        -->
        <BoxView x:Name="TouchObserber" BackgroundColor="Transparent" />
    </Grid>
</ContentView>

It's the only way to get it running on Android currently. Do you have any idea?

@DottorPagliaccius
Copy link

Do you have any idea?

I do, just remove the BoxView. I have no problem at all on Android, the only issue I had is when I added buttons inside the card, sometimes tap and pan gesture confilct due to a bug in android.

If you want have a look at my fork https://github.com/DottorPagliaccius/swipecards

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

No branches or pull requests

3 participants