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

Error on iOS with NS 5.3 #38

Closed bachras closed 5 years ago

bachras commented 5 years ago

Hi,

Thank you for great plugin. I am using NativeScript 5.3 and navitescript-image-swipe(4.1.0). I am receiving this error and after 10s or more image swipe appears. I am using physical device iPhone X (iOS 11.4), Android works fine.

I assume problem is with: https://github.com/PeterStaev/nativescript-image-swipe/blob/master/image-swipe.ios.ts#L310

Error:

CONSOLE ERROR [native code]: ERROR TypeError: 
undefined is not an object (evaluating 'scrollView.contentSize = CGSizeMake(this.items.length * calculatedWidth, height)')

Thanks

PeterStaev commented 5 years ago

Hey @bachras , can you simulate this using the provided demo apps in this repo? If not then it must be something specific for your case.

bachras commented 5 years ago

@PeterStaev thanks for prompt reply. I just tried demo-ng app on iOS simulator and I got a new error:

JavaScript error: file:///app/tns_modules/nativescript-image-swipe/image-swipe.js:231:52: JS ERROR TypeError: this.getSafeAreaInsets is not a function. (In 'this.getSafeAreaInsets()', 'this.getSafeAreaInsets' is undefined)

bachras commented 5 years ago

After updating to latest version, Android works but shows error :

JS: ERROR TypeError: Cannot read property 'getAdapter' of undefined
JS: ERROR CONTEXT {
JS:   "view": {
JS:     "def": {
JS:       "nodeFlags": 16793601,
JS:       "rootNodeFlags": 1,
JS:       "nodeMatchedQueries": 0,
JS:       "flags": 2,
JS:       "nodes": [
JS:         {
JS:           "nodeIndex": 0,
JS:           "parent": null,
JS:           "renderParent": null,
JS:           "bindingIndex": 0,
JS:           "outputIndex": 0,
JS:           "checkIndex": 0,
JS:           "flags": 1,
JS:           "childFlags": 16793601,
JS:           "directChildFlags": 1,
JS:           "childMatchedQueries": 0,
JS:           "matchedQueries": {},
JS:           "matchedQueryIds": 0,
JS:           "references": {},
JS:           "ngContentIndex": null,
JS:           "childCount": 8,
JS:           "bindings": [],
JS:           "bindingFlags": 0,
JS:           "outputs": [],
JS:           "element": {
JS:             "ns": "",
JS:             "name": "StackLayout",
JS:             "attrs": [
JS:               [
JS:                 "",
JS:                 "class",
JS:                 "_mod_a11___"
JS:               ]
JS:             ],
JS:             "template": null,
JS:             "componentProvider": null,
JS:             "componentView": nul...
bachras commented 5 years ago

I tried to reproduce the error on Playground(https://play.nativescript.org/?template=play-ng&id=4yGwoR&v=3) , but I got different error there:

[Galaxy S10+]: ERROR Error: Uncaught (in promise): TypeError: Could not load view for: ImageSwipe.Error: com.tns.NativeScriptException: Failed to find module: "nativescript-image-swipe/image-swipe", relative to: app/tns_modules/
[Galaxy S10+]: com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
[Galaxy S10+]: com.tns.Runtime.callJSMethod(Runtime.java:1070)
[Galaxy S10+]: com.tns.Runtime.callJSMethod(Runtime.java:1050)
[Galaxy S10+]: com.tns.Module.resolvePathHelper(Module.java:146)
[Galaxy S10+]: com.tns.Module.resolvePath(Module.java:55)
[Galaxy S10+]: com.tns.Runtime.callJSMethodNative(Native Method)
[Galaxy S10+]: com.tns.Runtime.callJSMethod(Runtime.java:1042)
[Galaxy S10+]: com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:20)
[Galaxy S10+]: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
[Galaxy S10+]: android.app.Activity.performCreate(Activity.java:7327)
[Galaxy S10+]: android.app.Activity.performCreate(Activity.java:7318)
[Galaxy S10+]: android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
[Galaxy S10+]: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3087)
[Galaxy S10+]: android.app.ActivityThre...
PeterStaev commented 5 years ago

Hey @bachras , the NG demo seems was forgot to be updated after the last plugin update. I will update it shortly.

As for your original error - I accidentally reproduced it on the demo app, and was happening because the initially selected image had an imageUrl that was not working anymore. So make sure all your images are loadable and are valid.

PeterStaev commented 5 years ago

No further response so closing this one for now. In case you still have problems, please provide more details.

Jarrich commented 5 years ago

This issue is not related to loadable and/or valid images. We're encountering this exact same issue with image url's that do work.

However, looking at the sourcecode and the line where it crashes, I don't see how we get that particular exception