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

not working in nativescript 7 #50

Open
ray007 opened this issue Oct 8, 2020 · 3 comments
Open

not working in nativescript 7 #50

ray007 opened this issue Oct 8, 2020 · 3 comments

Comments

@ray007
Copy link

ray007 commented Oct 8, 2020

On upgrading to nativescript 7 (and getting over many other problems), SVGImage does not seem to be compatible with the new version.
Or maybe it's only the vue-js wrapper? Which I have registered with

Vue.registerElement('SVGImage', () => require('@jnorkus/nativescript-svg').SVGImage);

Exception output on startup:

JS: {NSVue (Vue: 2.6.12 | NSVue: 2.8.1)} -> CreateElement(svgimage)
JS: TypeError: Class constructor View cannot be invoked without 'new'
JS: [Vue warn]: Error in nextTick: "TypeError: Cannot read property '$scopedSlots' of undefined"
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to start activity ComponentInfo{com.my.domain/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Cannot read property 'setAttribute' of undefined
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.loytec.lweb804/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Cannot read property 'setAttribute' of undefined
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3114)
System.err:     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3257)
System.err:     at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:78)
System.err:     at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:108)
System.err:     at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:68)
System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1948)
System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
System.err:     at android.os.Looper.loop(Looper.java:214)
System.err:     at android.app.ActivityThread.main(ActivityThread.java:7050)
System.err:     at java.lang.reflect.Method.invoke(Native Method)
System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
System.err: TypeError: Cannot read property 'setAttribute' of undefined
System.err:     at com.tns.Runtime.callJSMethodNative(Native Method)
System.err:     at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1302)
System.err:     at com.tns.Runtime.callJSMethodImpl(Runtime.java:1188)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1175)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1153)
System.err:     at com.tns.Runtime.callJSMethod(Runtime.java:1149)
System.err:     at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:29)
System.err:     at android.app.Activity.performCreate(Activity.java:7327)
System.err:     at android.app.Activity.performCreate(Activity.java:7318)
System.err:     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1271)
System.err:     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3094)
System.err:     ... 11 more

Note: I'm using the plugin-version from @jnorkus, but looking at the repository tree, I suspect all will have the same problem.

@ray007
Copy link
Author

ray007 commented Oct 13, 2020

Not sure if it's a typescript problem, or a problem of the existing js-file, but the exception happens in svg.common.js in the constructor:

var SVGImage = (function (_super) {
    __extends(SVGImage, _super);
    function SVGImage(options) {
        return _super.call(this) || this;
    }
...
}

And the call _super.call(this) is the one the browser is complaining about.

@ray007
Copy link
Author

ray007 commented Oct 15, 2020

Update: this does seem to be a problem of typescript output.

But for nativescript 7, maybe setting the target to "es6" could fix the problem?

@SmailHammour
Copy link

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

2 participants