Closed etelford closed 5 years ago
Hey @etelford , thanks for this contribution!
The current version of the plugin is set to build with TNS 4.0. So the build fails as this method is not present. Please adjust tns-core-modules
and tns-platform-declarations
to 5.0.0 so the build and CI can succeed.
@PeterStaev Thanks for catching that. I adjusted the versions to 5.0.0, but CI is still failing due to __native
not being found in image-swipe.android.ts
. I'm happy to change these instances to native
if you'd like, but I'm not sure if that's the fix needed. Please let me know what you think.
@etelford __native()
should be replaced with global.__native()
@PeterStaev Looks like everything is passing now. Thanks for the guidance.
This fixes a bug on iPhones with Safe Area Insets (iPhone X, Xs, Xs max, etc.) where by just using
utils.layout.toDeviceIndependentPixels(this.getMeasuredWidth());
to calculate the width prevents you from scrolling completely through a group of image items.For example, I had 14 images in my items and after scrolling to the 12th image, I was only able to scroll half way to the 13th image.
My fix involves using getSafeAreaInsets(). On devices without Safe Area Insets, this will return
{ left: 0, top: 0, right: 0, bottom: 0 }
, but on devices with a Safe Are Inset these values will be > 0. On iPhone Xs max, theleft
is132
. Running this throughutils.layout.toDeviceIndependentPixels()
on this device will result in44
, which is half of the width we need to account for.I'm not sure if Android would need a similar affordance. Maybe someone with more Android experience can weigh in.