Code Monkey home page Code Monkey logo

Comments (23)

EddyVerbruggen avatar EddyVerbruggen commented on July 16, 2024

It's only possible on iOS, so I didn't provide a hook for it in the JS API. I may add it in the future for iOS.

from toast-phonegap-plugin.

zarko-tg avatar zarko-tg commented on July 16, 2024

I guess it could be done for Android as well using a custom toast view.
Ref. http://developer.android.com/guide/topics/ui/notifiers/toasts.html#CustomToastView

from toast-phonegap-plugin.

ajbraus avatar ajbraus commented on July 16, 2024

+1

from toast-phonegap-plugin.

tylercollier avatar tylercollier commented on July 16, 2024

+1

from toast-phonegap-plugin.

hirbod avatar hirbod commented on July 16, 2024

👍

from toast-phonegap-plugin.

unr avatar unr commented on July 16, 2024

👍 for iOS styling.

from toast-phonegap-plugin.

hirbod avatar hirbod commented on July 16, 2024

Would love to see this feature... And maybe the option without rounded corners..

from toast-phonegap-plugin.

leandro-machado-costa avatar leandro-machado-costa commented on July 16, 2024

+1

from toast-phonegap-plugin.

BenAtStatement1 avatar BenAtStatement1 commented on July 16, 2024

would be nice to be able to set some sizes -- toast looks small on iPad.

from toast-phonegap-plugin.

OlivierCo avatar OlivierCo commented on July 16, 2024

It's quite easy to do it for both platform...

from toast-phonegap-plugin.

unr avatar unr commented on July 16, 2024

@OlivierCo Your comment isn't helpful.

How is it easy to do for both platforms? Do you have an example?

from toast-phonegap-plugin.

danielgolub avatar danielgolub commented on July 16, 2024

Are there any updates over this?

from toast-phonegap-plugin.

isayeter avatar isayeter commented on July 16, 2024

I want to show a red background colored toast message, how can I do that? any update ?

from toast-phonegap-plugin.

EddyVerbruggen avatar EddyVerbruggen commented on July 16, 2024

Let me give this a try now..

from toast-phonegap-plugin.

EddyVerbruggen avatar EddyVerbruggen commented on July 16, 2024

Got this working on Android (not released yet, so just FYI).
Not passing in the styling object will fall back to what you're used to:

  window.plugins.toast.showWithOptions({
    message: 'Toooooast',
    duration: 'long',
    position: 'bottom',
    styling: {
      backgroundColor: '#FF0000', // red
      borderRadius: 30, // a bit less than default, 0 means a square Toast
      alpha: 180, // 0-255, 0 being fully transparent
      padding: {
        top: 20,
        right: 30,
        bottom: 20,
        left: 30
     }
  }

I will need to look at iOS to make sure these property names make sense.

from toast-phonegap-plugin.

isayeter avatar isayeter commented on July 16, 2024

You are just awesome, I'm waiting iOS version too, now. Thank you for fast response.

from toast-phonegap-plugin.

EddyVerbruggen avatar EddyVerbruggen commented on July 16, 2024

iOS implementation is ready to go locally but I need to do a little rework to update the Android API as this is what I've now settled for:

  styling: {
    backgroundColor: '#FF0000',
    cornerRadius: 16,
    opacity: 0.75, // 0.0 to 1.0 just like CSS
    horizontalPadding: 16, // iOS uses the same values for left and right and it makes sense to keep it simple like this
    verticalPadding: 12 // ditto
  }

Of course you can pass in the same values for styling on iOS and Android, but if you want to use different values you can easily do:

  styling: {
    cornerRadius: iOS ? 16 : 20,
  }

Where iOS is a variable you can f.i. get from the device plugin.

i hope this makes sense and I'll try to wrap this up tomorrow.

from toast-phonegap-plugin.

isayeter avatar isayeter commented on July 16, 2024

Thank you so much for your effort beforehand. Waiting your commit impatiently.

from toast-phonegap-plugin.

zarko-tg avatar zarko-tg commented on July 16, 2024

To whom it may concern :)
For more advanced needs (on an Angular project) one can use https://github.com/Foxandxss/angular-toastr instead of this plugin.

from toast-phonegap-plugin.

hirbod avatar hirbod commented on July 16, 2024

The big difference between a native and an angular solution is, that this plugin is always on the highest view - even above inappbrowser. If most-top isn't important for you, grab angular, if not, this plugin is the best shot (less Dom nodes, smoother animation, background threads / non blocking.

from toast-phonegap-plugin.

EddyVerbruggen avatar EddyVerbruggen commented on July 16, 2024

Hey guys, thanks for the assistance and discussions in this issue.

I've now released 2.4.0 to npm which allows styles like these (iOS screenshots):

styling-green

styling-red

Check out the readme for details!

🍻
Eddy

from toast-phonegap-plugin.

unr avatar unr commented on July 16, 2024

Fantastic, Thanks @EddyVerbruggen :)

from toast-phonegap-plugin.

isayeter avatar isayeter commented on July 16, 2024

You are just God damn perfect ! Thank you @EddyVerbruggen

from toast-phonegap-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.