triniwiz / nativescript-toasty

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

Uncaught (in promise): Error: There is no topmost #26

Open AnastasiyaDemi opened 5 years ago

AnastasiyaDemi commented 5 years ago

Hello @triniwiz , first of all - thank you for this and your other plugins.

Migrated here due to https://github.com/TobiasHennig/nativescript-toast/issues/40, and now i'm having trouble running nativescript-toasty v2.0.1 on tns-ios 6.0.1:

CONSOLE ERROR file:///node_modules/@angular/core/fesm5/core.js:5847:0 ERROR Error: Uncaught (in promise): Error: There is no topmost
_getView@file:///node_modules/nativescript-toasty/toasty.js:168:0
show@file:///node_modules/nativescript-toasty/toasty.js:102:0
showToast@file:///src/app/services/notification.service.ts:80:14
file:///src/app/app.component.ts:109:38
onInvoke@file:///node_modules/@angular/core/fesm5/core.js:24349:0
file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:883:0
onInvokeTask@file:///node_modules/@angular/core/fesm5/core.js:24340:0
drainMicroTaskQueue@file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:595:0
file:///node_modules/nativescript-angular/platform-common.js:174:0
notify@file:///node_modules/tns-core-modules/data/observable/observable.js:110:0
[native code] [<root>]
notifyAppStarted@file:///node_modules/tns-core-modules/application/application.js:143:0
didFinishLaunchingWithOptions@file:///node_modules/tns-core-modules/application/application.js:135:0
[native code] [<root>]
onReceive@file:///node_modules/tns-core-modules/application/application.js:33:0
UIApplicationMain@[native code] [<root>]
_start@file:///node_modules/tns-core-modules/application/application.js:277:0
run@file:///node_modules/tns-core-modules/application/application.js:305:0
bootstrapNativeScriptApp@file:///node_modules/nativescript-angular/platform-common.js:205:0
b<…>

Displaying toast via this service method:

  public showToast(message: string) {
    new Toasty({text: message}).show();
  }

Can you please suggest what is this 'topmost' and, maybe, how to fix that?

razorsyntax commented 4 years ago

I'm getting this same console error as well on 6.2.0 iOS.

two-bridges commented 3 years ago

This Topmost error occurs for me when I call Toasty from app.component.ts (and toasty is in a service.ts file)

It works fine so long as it is called from another component, such as any page component rendered inside page-router-outlet

6.5.2 iOS