Creating Custom Gestures with Ionic (Tinder Swipe & Long Press)

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 70

  • @jester9300
    @jester9300 4 года назад +6

    Hi Simon, excellent video.
    I also had trouble with activating the "long-press" gesture. Upon investigation it was caused by the "threshold" value that was set to a default of 10. This meant that on desktop, where one can easily keep the mouse still, the pointer did not move enough to overcome the threshold and start gesture capture.
    SOLVED this by adding the gesture threshold back in and setting it to a lower value (2 in my case, as I vaguely remember that value from HammerJS usage with press events).
    Anycase, thank you for your thorough tutorials and excellent teaching attitude. Your videos have been a great help while I move from Ionic 3 to Ionic 5.

    • @galaxies_dev
      @galaxies_dev  4 года назад

      Thanks for digging into this and posting your solution!!

    • @Ixtinkt
      @Ixtinkt 2 года назад

      For simulator I had to set threshold: 0 to make it working;

    • @jared4670
      @jared4670 2 года назад

      @@Ixtinkt yeah. if I don't use anything other than 0 it does not activate. Guess I will need to perform more testing on an actual mobile phone. Still want to be able to keep my slide down to refresh gesture as well!

  • @dksanket
    @dksanket 4 года назад +5

    Thank you Simon, Awesome video. But how can I make it work for dynamic elements? Say I want to apply 'long-press' gesture for each message in the chat box and the messages are loaded dynamically when I scroll through the page. Any help would be greatly appreciated. Thank you

  • @mohammadmollaei6278
    @mohammadmollaei6278 4 года назад +4

    Thanks Simon for great video
    would you make some tutorials related to IONIC Capacitor API's like social login
    Thanks!

  • @vivienskapuku2388
    @vivienskapuku2388 2 года назад

    Thanks a lot. I have an old built in Ionic3. How can I perform the tinder swipe?

  • @therealhaxwell
    @therealhaxwell 2 года назад

    Thanks!

  • @frank12328
    @frank12328 Год назад

    nice explanations, mmm you know how i prevents to close the keyboard when long press an element?

  • @shivanshsubnani3383
    @shivanshsubnani3383 2 года назад

    Hi Simon, I want to apply swipe up gesture like in (InShorts App) and also want an undo of card as well to show the previous card ! can you help me with that ?

  • @Trookboss7396
    @Trookboss7396 4 года назад +2

    Wow. Fantastic. Great video. Thank you

  • @davidebser2867
    @davidebser2867 3 года назад +1

    Nice that was exactly what we needed thy :)

  • @mdomerarafat4611
    @mdomerarafat4611 4 года назад +2

    Nice video !

  • @manuelalejandrogalvez8716
    @manuelalejandrogalvez8716 4 года назад +1

    Great video! Thanks Simon.

  • @jared4670
    @jared4670 2 года назад

    Well I encountered the same issue as sone did in the comments where you need to move the cursor for it to trigger when pressing down. The only problem with this is if you have also implemented the Io nic page refresher, it stops that from happening. Adding the threshold param then causes the gesture to not activate at all...

  • @66marten
    @66marten 3 года назад

    At 14:00 the photos are among each other. Then at 14:30 the photos are suddenly on top of each other. But nowhere I can see how this came about. How were the pictures superimposed?

  • @selvaganapathi7930
    @selvaganapathi7930 4 года назад

    There is possible using button click to select or unselect

  • @tanishqmanuja
    @tanishqmanuja 4 года назад +2

    Awesome Content Simon ! , BTW you look like an indian actor Pankaj Tripathi

    • @uzroot
      @uzroot 4 года назад

      LOL no

  • @ankitchauhan1790
    @ankitchauhan1790 4 года назад

    hey simon its a great video, really helpfull,
    but what if i need to swipe a card in both direction (ie. x any y),
    like in tinder, super like swipe in y direction...
    can you please provide solution for that,
    thanks in advance

  • @ricardomachado4018
    @ricardomachado4018 3 года назад

    if I want to go the first position again? when finishes in end, how came back to first position like a cycle?

  • @marcosricardo5213
    @marcosricardo5213 4 года назад +1

    Thank a lot, Simon. Cool video!

  • @SemEkkelboom
    @SemEkkelboom 3 года назад

    Does this not work on ion-buttons? I'm running into issues where tapping a button once works, but long pressing does not, even when following your example. Also, tapping with two fingers on two different buttons almost immediately after each other, does not trigger a (click)="functionHere()" event for either of the buttons. Any idea what we're doing wrong?

  • @sergeykudryashov9201
    @sergeykudryashov9201 2 года назад

    Please show us the end of decimalToHex method

  • @NahueAlberti
    @NahueAlberti 3 года назад

    i need the disable this gesture... do you know how to do it?

  •  4 года назад +1

    Nice example, useful for animated CRUD functionalities, now everything must look fun, not only functional required nowadays :/

    • @galaxies_dev
      @galaxies_dev  4 года назад

      Yeah that's right, upload an app with boring design and nobody is going to use it anyway :(

  • @rachnasingh8976
    @rachnasingh8976 4 года назад

    Hi sir,
    i used ion-segment
    i have 7 segments but when i swap then last 3 segment tabs are not moved
    please solve this problem

  • @israelayokunnu7974
    @israelayokunnu7974 4 года назад +1

    Thank you!

  • @igorigor806
    @igorigor806 4 года назад +1

    Thank you very much, Simon :)

  • @PauloSantos-yu1tn
    @PauloSantos-yu1tn 4 года назад

    Was very cool tutorial. Enjoyed so much. Physics is cool. Thanks good job

  • @Zahirul3
    @Zahirul3 4 года назад +1

    It was so cool!!

  • @blakebedford-palmer6676
    @blakebedford-palmer6676 3 года назад

    I did my tinder swiping using ion-slides with the cube transition (and the slides on each side were a ❤️ and a ❌)
    But wouldn’t rule out a better way like this

  • @jonnyramen1480
    @jonnyramen1480 4 года назад

    Awesome video Simon!!!

  • @saq.ib01
    @saq.ib01 Год назад +1

    Please add Double Click gesture.

  • @denniscezar
    @denniscezar 4 года назад +2

    Thanks Simon!
    In future videos, can u do a updated video about Ionic 5 Image Capture & Upload With NodeJS?
    Thanks!

    • @galaxies_dev
      @galaxies_dev  4 года назад

      I feel like the image upload changes in every version although Ionic is not really changing that part at all. But yeah, might be a cools idea for a series!

  • @Mewain
    @Mewain 4 года назад

    Hi Simon, how should i do if i want to make a tinder card swippeable, but also vertically scrollable ?

    • @galaxies_dev
      @galaxies_dev  4 года назад

      Good question, I'm not sure if that actually works... Perhaps you can disable the gesture when a scroll event from the content is received, something like this?

  • @mayankkataria7080
    @mayankkataria7080 4 года назад

    How to get rotation angle in ionic gesture api?

  • @jatinkumawat6387
    @jatinkumawat6387 4 года назад

    Hi Simon, thanks for another great video.
    I am facing problem while following this tutorial in ngAfterViewInit() where you wrote this.cards.toArray().
    My console.log says that this.cards.toArray() is not a function.
    Can you help me out with this?

    • @mustafabekec
      @mustafabekec 4 года назад +2

      Make sure you use this part correctly
      Not ViewChild
      @ViewChildren(IonCard, { read: ElementRef }) cards: QueryList;
      I know why? Because I made the same mistake :)

    • @jatinkumawat6387
      @jatinkumawat6387 4 года назад +1

      @@mustafabekec DUUUDDDDDEEEEEEEE
      Thank you dude.
      You literally saved me.
      I wasted few hours on this mistake.
      Thank you so much man.

    • @jatinkumawat6387
      @jatinkumawat6387 4 года назад

      @@mustafabekec
      Can you help a bit more please?😅
      Simon here used people[ ] which already had 3 elements inside it, but I want to add more in it, say by using random user api - basically by sending a request to http:randpmuser.me/api which will send me some data.
      Now I want to show this new data as well in tinder cards
      Can you help mere here 😅😅

  • @prashant43240
    @prashant43240 4 года назад

    How we restrict last card to move?

  • @shubhammore4922
    @shubhammore4922 4 года назад

    Thanks you so much Simon for these great content. would you do some videos on augmented reality in ionic. how to build camera filters for editing videos and pictures

    • @galaxies_dev
      @galaxies_dev  4 года назад

      I guess that's a complicated topic, but I'll add it to my list!

  • @AnkurShah_CS
    @AnkurShah_CS 3 года назад

    isn't there a direct longpress kind of thing in ionic? I want to use it on ion-item, in a list, but no luck! I tried longpress, press, keypress, keyup,... nothing worked!

    • @galaxies_dev
      @galaxies_dev  3 года назад

      No there is no built-in long press gesture!

  • @milothoxha2513
    @milothoxha2513 3 года назад +1

    Since I had to do that in a component, I didn't have to do a foreach of the elements, but what I did is that I added ViewChild instead of ViewChildren, like this:
    @ViewChild('shareElement', {read: ElementRef}) shareElement: ElementRef;
    with threshold commented, I was getting onStart event only after i swipe., i had to bring back threshold: 0 to make it work, like this:
    const gesture: Gesture = this.gestureCtrl.create({
    el: this.shareElement.nativeElement,
    threshold: 0,
    gestureName: 'long-press',
    onStart: ev => {
    console.log(ev);
    this.longPressActive = true;
    },
    onEnd: ev => {
    console.log(ev);
    this.longPressActive = false;
    }
    // onMove: ev => this.onMoveHandler(ev)
    });
    gesture.enable(true);
    Thanks alot. I appriciate it.

    • @galaxies_dev
      @galaxies_dev  3 года назад +1

      Thanks for sharing your addition Milot!

    • @milothoxha2513
      @milothoxha2513 3 года назад

      @@galaxies_dev I also forgot that I had to add #shareElement on the html part. My pleasure, and thank you for your videos. Keep it up :)

  • @hobbyturystaSEO
    @hobbyturystaSEO 4 года назад

    Hey. I think about the gallery of let say 3 or 6 items ( thumbnails pictures ) with one big ( full screen ) preview. I thinking to move between thumbs and full preview DIV by a gesture. Is this possible in IONIC? Maybe somebody sees this kind of gallery in a mobile app? If yes please let me know in a comment. cheers

    • @galaxies_dev
      @galaxies_dev  4 года назад

      I think this would also be possible with the Angular Drag&Drop CDK! But it might be possible with Ionic as well, but you would have to make some calculations when elements are dropped and perform some logic to exchange them then.

  • @yogeshravi4033
    @yogeshravi4033 3 года назад

    is it possible to perform swipe up ? i can't able to perform swipe up gesture!

    • @galaxies_dev
      @galaxies_dev  3 года назад

      Sure you could add a Swipe handler for the Y direction and then catch the onMove event!

    • @yogeshravi4033
      @yogeshravi4033 3 года назад

      @@galaxies_dev yeah I tried that by setting direction to Y instead of X yet when i swipe up still delta X value gets updated and card displaces from left to right!

  • @milothoxha4430
    @milothoxha4430 4 года назад

    Hi Simon,
    Your're great, thank you for this amazing video tutorial :D
    Could you be able to do a Show/Hide Header for Ionic 4/5 on Scroll? I have been trying with directives and stuff but the result is so rubbish and on iOS is so flickering.
    Also, something about file compressing, file resize? that would be great too.
    Thank you :)

    • @galaxies_dev
      @galaxies_dev  4 года назад +1

      Completely hide the header, or simply the new iOS behaviour with small headers?

    • @milothoxha4430
      @milothoxha4430 4 года назад

      @@galaxies_dev Completely Hide the header, when you scroll down the header shows, when you scroll up the header hides.
      can you check this out please? I have posted a question on stackoverflow about this and to this day i am facing issues.
      stackoverflow.com/questions/60567023/ionic-4-hide-show-header-directive-animation-lags-while-scrolling
      Lets also say that you have an one header, and inside one header you have two toolbars, first top toolbar is the title, second bottom toolbar is the search-bar, the one you want to show/hide on scroll.
      This behavior should happen every time the user scrolls up/down, not like the iOS behavior that happens only when you reach the top of it. Its strange because it lags a lot, and it is not smooth at all which gives a bad UX to the user. We have managed to have a fix at it but still it still not that smooth.
      Thanks for replying :)

  • @paragbhide1695
    @paragbhide1695 4 года назад

    Thanks simon .. one more helpful video from your channel as always! If your channel wouldn't be here I would have probably shifted to React
    ***Also just to remind you, awaiting for your video on displaying already stored videos(from memory card as well as from Internal memory storage ) on mobile, probably in a folder structure like in a typical offline mobile video player it displays

    • @galaxies_dev
      @galaxies_dev  4 года назад

      Glad they were helpful, and thanks for the idea!

  • @Prash3393
    @Prash3393 4 года назад +1

    always fan

  • @giuliopretis
    @giuliopretis 3 года назад

    This is a bit frustrating and not so clear when compared to native development long press functions.

    • @galaxies_dev
      @galaxies_dev  3 года назад

      Yes it is indeed a bit different, I agree.

  • @ishraq95
    @ishraq95 4 года назад +1

    Long waited features..

  • @jonathanperry169
    @jonathanperry169 4 года назад +1

    Great video Simon. Thank you

  • @bhavanigattikoppula2077
    @bhavanigattikoppula2077 3 года назад

    How to get previous card data using right swipe?