Toast in the browser


#1

Hello,
the toast plugin is not supported in the pager for a PWA?
I do ionic cordova build browser then ionic cordova run browser
and I receive in console Native: tried calling Toast.show, but the Toast plugin is not installed.
and Install the Toast plugin: 'ionic cordova plugin add cordova-plugin-x-toast'

if there is no support by the browser how to make the message appear?


#2

Why do you use a Cordova Toast plugin and not use the build-in toast provided by Ionic which will work on Android, iOS and on the Web/PWA?

Regarding your error, if the Cordova Toast plugin doesn’t support the “browser”/web version, then only way to not have the error is to not call it


#3

Hello @reedrichards
I used the official docs https://beta.ionicframework.com/docs/native/toast/
that’s why I do not understand this error


#4

Again, pourquoi as-tu besoin d’utiliser un plugin Cordova pour ton “toast”? tu as un besoin spécifique?

la documentation que tu links est un wrapper “Cordova toast” mais Ionic propose par défaut un toast qui fonctionnera partout (“sans Cordova”)

“Cordova toast” -> https://beta.ionicframework.com/docs/native/toast/

“Toast qui marche partout” -> https://beta.ionicframework.com/docs/api/toast

Si tu n’as pas de besoin spécifique, supprime le plugin et son wrapper native et passe au toast standard


#5

arfff excuse my level so zero :expressionless:
I did not see that there was a native and an api
I’m going to change that


#6

No worries and not level zero at all, I mean they both have the same name, could be confusing

Let me know if it work out


#7

re,
it works well thank you.
I just have the problem of position that I put on middle but it remains top.
I am looking for the solution.
thanks again for the answer


#8

which Ionic v4 version? There used to be a bug but I think it’s solved in the very last beta

ps.: cool to hear it worked out :slight_smile:


#9

ionic info

Ionic:

ionic (Ionic CLI) : 4.0.6 (C:\Users\ludo\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.15
@angular-devkit/core : 0.8.7
@angular-devkit/schematics : 0.8.7
@angular/cli : 6.2.7
@ionic/ng-toolkit : not installed
@ionic/schematics-angular : not installed

Cordova:

cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)
Cordova Platforms : not available

System:

NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

Environment:

ANDROID_HOME : not set


#10

Beta.17 is out. Pay attention to the migration to Angular v7 introduced by beta.16 https://github.com/ionic-team/ionic/blob/master/CHANGELOG.md


#11

here is done and it works

Ionic:

ionic (Ionic CLI) : 4.0.6 (C:\Users\ludo\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.17
@angular-devkit/core : 0.8.7
@angular-devkit/schematics : 0.8.7
@angular/cli : 6.2.7
@ionic/ng-toolkit : not installed
@ionic/schematics-angular : not installed

Cordova:

cordova (Cordova CLI) : 8.1.1 (cordova-lib@8.1.0)
Cordova Platforms : android 7.1.2, browser 5.0.4, ios 4.5.5

System:

NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

Environment:

ANDROID_HOME : not set

is what I need to install @ionic/ng-toolkit and @ionic/schematics-angular?


#12
  1. First of all, you should maybe update your Ionic CLI too, current version 4.5.0 :wink:

      npm install -g ionic
    
  2. ng-toolkit and schematics-angular has been deprecated in favor of @ionic/angular-toolkit

  3. I would say yes

     npm install @ionic/angular-toolkit --save

#13

I did npm install -g ionic but ionic info always gives me ionic (Ionic CLI): 4.0.6


#14

Either the install didn’t work because you didn’t had the rights to install it (check chown and chmod on the global ionic) or your cmd doesn’t point on the right ionic


#15

I am the only user of the pc and I use the terminal of visual studio code directly in my app


#16

On PC I can’t help that much. In any case you could keep going without updating the CLI, it would be just good one of these days to update it


#17

it’s bizzare, I did npm install -g ionic
I received the message in my console asking me to update with npm i -g ionic
restart my pc and nothing, it’s always the same when it tells me ionic@4.5.0 updated 1 package in 11.076s