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

ion-content scroller stopped working on device #58

Open
kajalbh99 opened this issue Jun 8, 2018 · 4 comments
Open

ion-content scroller stopped working on device #58

kajalbh99 opened this issue Jun 8, 2018 · 4 comments

Comments

@kajalbh99
Copy link

Package is working fine in browser. But when i run Apk in device, I found content scroll stopped working...

@hudsonsilvaoliveira
Copy link

Same problem here with me @kajalbh99. Any news on that? I'll take a closer look at this later, but I feel like that's a problem with HAMMER_GESTURE_CONFIG, which we need to import in order to get the gallery working. I've found this hammerjs/hammer.js#1014 and this https://stackoverflow.com/questions/41017202/vertical-scroll-is-not-working-with-hammerjs-and-angular2/41522140. Kinda sketchy, but I'm taking anything at this point. The home screen of my app is not scrolling. I'll try this or be forced to remove the gallery all together.

@hudsonsilvaoliveira
Copy link

GOT IT!

Based on hammerjs/hammer.js#1014 (comment), I've managed to got everything working now.

Going throught the files I've saw that the ionicGalleryModal.GalleryModalHammerConfig is nothing more than a extend of the standard HammerGestureConfig from @angular/platform-browser. So, I just combined the GalleryModalHammerConfig with the HammerGestureConfig in my own class. The code turned out like this:

import { HammerGestureConfig } from '@angular/platform-browser';
import { HAMMER_GESTURE_CONFIG } from '@angular/platform-browser';

declare var Hammer: any;

export class HammerConfig extends HammerGestureConfig {
    overrides: {
        pan: {
            direction: number;
        };
        press: {
            time: number;
        };
    };

    buildHammer(element: HTMLElement) {
      let mc: any = new Hammer(element, {
        touchAction: "pan-y"
      });
      return mc;
    }
}

@NgModule({
    declarations: [],
    imports: [
        ionicGalleryModal.GalleryModalModule
    ],
    providers: [
        { provide: HAMMER_GESTURE_CONFIG, useClass: HammerConfig }
    ]
})

It's working now, I hope it'll help. I don't really know why that happened tho, would be very helpful if someone could point that out.

@jayzyaj
Copy link

jayzyaj commented Sep 7, 2018

@hudsonsilvaoliveira Where did you found that file? did you created id? And how would I import it?

@hudsonsilvaoliveira
Copy link

@jayzyaj our custom class code goes into your /ionicapp/src/app/app.module.ts, right before the @NgModule({}) declarations.

We are actually just rewriting the GalleryModalHammerConfig (https://github.com/nikini/ionic-gallery-modal#installation), used in the providers section, that didn't work as expected for some reason.

So, instead of using the useClass: ionicGalleryModal.GalleryModalHammerConfig as the documentation pointed out, we use our new class useClass: HammerConfig, which we just created right before.

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

3 participants