PeterStaev / nativescript-image-swipe

A NativeScript widget to easily :point_up_2: and :mag: through a list of images
Apache License 2.0
35 stars 21 forks source link

Crash with NativeScript 5.0.0 #32

Closed VladimirAmiorkov closed 5 years ago

VladimirAmiorkov commented 5 years ago

Got this error after upgrading to NativeScript 5.0.0 + Angular 7.0.0:

ERROR Error: Uncaught (in promise): TypeError: undefined is not an object (evaluating 'scrollView.pagingEnabled = true') ImageSwipe@file:///app/tns_modules/nativescript-image-swipe/image-swipe.js:17:19 createView@file:///app/tns_modules/nativescript-angular/view-util.js:212:33 createElement@file:///app/tns_modules/nativescript-angular/renderer.js:127:40 createElement@file:///app/tns_modules/nativescript-angular/renderer.js:404:55 createElement@file:///app/tns_modules/@angular/core/bundles/core.umd.js:20730:49 createElement@file:///app/tns_modules/@angular/core/bundles/core.umd.js:17429:44 createViewNodes@file:///app/tns_modules/@angular/core/bundles/core.umd.js:19681:43 callViewAction@file:///app/tns_modules/@angular/core/bundles/core.umd.js:20036:32 execComponentViewsAction@file:///app/tns_modules/@angular/core/bundles/core.umd.js:19955:31 createViewNodes@file:///app/tns_modules/@angular/core/bundles/core.umd.js:19748:<…>

Here is the component to which I am navigating that holds the swipe view:

<GridLayout rows="*, auto, auto">
    <ImageSwipe>
    </ImageSwipe>
</GridLayout>

Even with nothing set to the ImageSwipe the error is thrown. Looks like there is an issue with the initialization of the .ios portion of the ImageSwipe instance with NativeScript 5.0.0

VladimirAmiorkov commented 5 years ago

@PeterStaev This https://github.com/PeterStaev/nativescript-image-swipe/blob/master/image-swipe.ios.ts#L30 should be moved out of the constructor and into the initNativeView() because it is too early to access it in the TS constructor.

VladimirAmiorkov commented 5 years ago

I have made a PR that resolves this issue: https://github.com/PeterStaev/nativescript-image-swipe/pull/33

CC @PeterStaev can you review this and plan a publish of new version? Thank you.

VladimirAmiorkov commented 5 years ago

Closed via https://github.com/PeterStaev/nativescript-image-swipe/pull/33

PeterStaev commented 5 years ago

Hey @VladimirAmiorkov , thanks for tracing and fixing this 👍 New version is now on npm 😉

VladimirAmiorkov commented 5 years ago

@PeterStaev Awesome, no problem happy to help. Thank you.