triniwiz / nativescript-toasty

:bread: NativeScript toast plugin :bread:
Other
44 stars 21 forks source link

Cannot read property ‘setOnTouchListener’ of null #45

Open earnestware opened 4 years ago

earnestware commented 4 years ago

I have a project I’m working on and have come across a weird situation. My primary dev machine is iMac Pro and I use bitbucket to store the code. I also pull to my MacBook to code while relaxing... the problem is with nativescript-toasty. Everything works fine on the iMac but on the MacBook Pro it throws an exception TypeError: Cannot read property ‘setOnTouchListener’ of null... I’m guessing this is line 30 of toasty.android.ts I’m asking here because maybe this is a set up issue?

triniwiz commented 4 years ago

Can you share the code you are using ?

felixkrautschuk commented 4 years ago

I also got this issue now, for me it only occurs on Android 11 (working fine on 8, 9 and 10)

I am using

This is what I am doing:

function showToast(text: string) {
    new Toasty({ text : text })
        .setToastDuration(ToastDuration.SHORT)
        .setToastPosition(ToastPosition.BOTTOM)
        .setTextColor("#FFFFFF")
        .setBackgroundColor("#656565")
        .show();
}

The app does not crash, but the toast is not shown and I see the error message from this thread in the log: TypeError: Cannot read property 'setOnTouchListener' of null (Android 11)

triniwiz commented 4 years ago

Ok good to know it which version it happens on

dmoptimal commented 3 years ago

I'm using pretty much the same specs and I also get this issue (only on Android 11)

juniorschen commented 3 years ago

any solutions?

earnestware commented 3 years ago

Can you share the code you are using ?

this.toast = new Toasty({ text: "Some message" }); this.toast.show();

The problem is android version>10.

triniwiz commented 3 years ago

this is fixed in @triniwiz/nativescript-toasty

denkan commented 3 years ago

this is fixed in @triniwiz/nativescript-toasty

@triniwiz How do you mean? Can't see any updates on Github repo, NS marketplace nor NPM.

Any advice on how to fix the issue is appreciated.

EDIT: Oh, my bad. Here they are: https://market.nativescript.org/plugins/@triniwiz/nativescript-toasty/ https://www.npmjs.com/package/@triniwiz/nativescript-toasty

Maybe update the readme on nativescript-toasty and reference NS >7.0 to @triniwiz/nativescript-toasty? EDIT 2: Haha, just saw the readme was indeed correct here on Github. My bad, looking at NPM/NS Marketplace.

triniwiz commented 3 years ago

this is fixed in @triniwiz/nativescript-toasty

@triniwiz How do you mean? Can't see any updates on Github repo, NS marketplace nor NPM.

Any advice on how to fix the issue is appreciated.

EDIT: Oh, my bad. Here they are: https://market.nativescript.org/plugins/@triniwiz/nativescript-toasty/ https://www.npmjs.com/package/@triniwiz/nativescript-toasty

Maybe update the readme on nativescript-toasty and reference NS >7.0 to @triniwiz/nativescript-toasty? EDIT 2: Haha, just saw the readme was indeed correct here on Github. My bad, looking at NPM/NS Marketplace.

https://github.com/triniwiz/nativescript-plugins/tree/master/packages/nativescript-toasty