Ionic - Double Tap?

Can someone tell me how to have Double Tap working with ionic 3 for iOS? I don’t see this listed as a default gesture in

Ouput of ionic info:

cli packages: (xxx)

    @ionic/cli-plugin-cordova       : 1.6.1
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-plugin-proxy         : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1 

local packages:

    @ionic/app-scripts : 2.0.2
    Cordova Platforms  : ios 4.4.0
    Ionic Framework    : ionic-angular 3.5.3


    Android SDK Tools : 26.0.2
    Node              : v6.9.1
    OS                : OS X El Capitan
    Xcode             : Xcode 8.2.1 Build version 8C1002 
    ios-deploy        : 1.9.1 
    ios-sim           : 6.0.0 
    npm               : 3.10.8 

A quick search turns up this solution:

Do you mean I have to implement myself. Ionic doesn’t have native support for double tap?

Based on my ~5 minutes of research that’s what I found. I haven’t had any use for double-tap myself so I don’t have a first-hand solution for you, sorry. The implementation looks simple though, it’s all right there for you.

Thank you for your reply. But I though that ionic being in version 3 would handle gestures better. Since no one from ionic team have responded I assume that I will have to implement the double tap myself, exactly what I was trying to avoid.


Any solution for this?

I had to implement the double tap gesture myself.

Mind sharing the solution :slight_smile: ?

A simple and straightforward way of implementing the doubletap, is shown below. The doubletap is “provided” by Ionic (which uses HammerJS under the hood), just not exposed in the way you probably wished / expected it to be. You could easily create your doubletap directive to make things even easier, which is recommended if you wanted to use e.g. the pinch gesture as described here:


<div #element>Your doubletap element</div>


@ViewChild('element') el: ElementRef;
private pressGesture: Gesture;

public ngAfterViewInit(): void {

  this.pressGesture = new Gesture(this.el.nativeElement);

  this.pressGesture.on('doubletap', (e:Event) => {

    // or ... this.yourMethod(e);


public ngOnDestroy(): void {

Thanks, it works just fine!

@dalie how to assign these method to multiple dynamic items?

Put it in a directive


and then bind through (doubletap)="myMethod(variable)"

@Tommertom thank you so much :grinning:

@mathewk, sorry, a bit late, and @Tommertom provided the right direction for you, but in case you are interested, and for for completeness;

# 1 create a new project
ionic start doubletap-in-ionic blank && cd doubletap-in-ionic
# 2 generate a new directive
ionic g directive pinch
# 3 add the DirectivesModule to your imports inside the app.module.ts.
import { DirectivesModule } from '../directives/directives.module';

  imports: [
# 4 open `src/directives/doubletap/doubletap.ts` and paste the following snippet 

import {
} from "@angular/core";
import { Gesture } from "ionic-angular";

  selector: "[doubletap]"
export class DoubletapDirective implements AfterViewInit, OnDestroy {
  private pressGesture: Gesture;

    // the actual element
    private el: ElementRef
  ) {}

  public ngAfterViewInit(): void {
    this.pressGesture = new Gesture(this.el.nativeElement);

    this.pressGesture.on("doubletap", (e: Event) => {

  // emit the `Event`, bind to (ondoubletap) in your markup
  @Output() public ondoubletap: EventEmitter<Event> = new EventEmitter();

  // clean things up
  public ngOnDestroy() {

# in e.g. `home.html` add the attribute directive and bind to the (ondoubletap) event
# 5 you can use it with an *ngFor or *ngIf etc.
<ion-item doubletap

Hope it helps, or maybe someone else!

1 Like

Good stuff!

Should be marked as solution imho

Note, this directive will also be triggered when you single tap on the element.

Note, this directive will also be triggered when you single tap on the element.

hi @dalie i have tried out you solution, i was facing issue can see and tell what is wrong in this code
ts file code
@ViewChild('doubleEle') doubleEle:ElementRef; private pressGesture:Gesture; public ngAfterViewInit():void{ console.log(this.doubleEle); this.pressGesture = new Gesture(this.doubleEle.nativeElement); this.pressGesture.listen(); this.pressGesture.on('doubletap',(e:Event)=>{ console.log(e); }); };
html file code

{{ patner.firstName}}

this is error
TypeError: Cannot read property ‘nativeElement’ of undefined
TypeError: Cannot read property ‘nativeElement’ of undefined
at MyFamilyPage.webpackJsonp.115.MyFamilyPage.ngAfterViewInit (my-family.ts:38)