Ionic-swing for swipeable cards


#1

I was using for a long time angular2-swing and swing.js to build swipeable (tinder) cards.

I recently ran onto problems on iOS where the scrollers in my app ended up being frozen (blocked, not possible to scroll) and it turns out that the problem was related to hammer.js (angular2-swing use swing.js which include/use hammer.js).

After having found that I thought, furthermore to the bug itself:

  1. Why importing hammer.js externally where there is already hammer.js inside Ionic

  2. When more libs have to be imported, slower the boot time gonna be, why importing this lib?

  3. And why importing lodash? I noticed that swing.js use lodash and therefore that lib has to be imported in my app too (lodash seems to be, after ionic serve, around 550kb!) which will have an impact on my boot time too (I don’t use lodash)

Therefore I created following fork of the two above libs:

This fork doesn’t reference an external hammer.js and replace lodash with underscore (50kb vs 500kb).

There is still place for improvement regarding typescript (I want to get rid of the class swing.ts) and probably also place to speed up the loading time, but still that’s for a me a cool first version.

It still need to be tested, but doesn’t look that bad.

If that may help someone too, make your self at home :wink:


[SOLVED] Swipe event freeze scroll on iOS and Android