Comments (23)
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.
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.
+1
from toast-phonegap-plugin.
+1
from toast-phonegap-plugin.
👍
from toast-phonegap-plugin.
👍 for iOS styling.
from toast-phonegap-plugin.
Would love to see this feature... And maybe the option without rounded corners..
from toast-phonegap-plugin.
+1
from toast-phonegap-plugin.
would be nice to be able to set some sizes -- toast looks small on iPad.
from toast-phonegap-plugin.
It's quite easy to do it for both platform...
from toast-phonegap-plugin.
@OlivierCo Your comment isn't helpful.
How is it easy to do for both platforms? Do you have an example?
from toast-phonegap-plugin.
Are there any updates over this?
from toast-phonegap-plugin.
I want to show a red background colored toast message, how can I do that? any update ?
from toast-phonegap-plugin.
Let me give this a try now..
from toast-phonegap-plugin.
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.
You are just awesome, I'm waiting iOS version too, now. Thank you for fast response.
from toast-phonegap-plugin.
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.
Thank you so much for your effort beforehand. Waiting your commit impatiently.
from toast-phonegap-plugin.
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.
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.
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):
Check out the readme for details!
🍻
Eddy
from toast-phonegap-plugin.
Fantastic, Thanks @EddyVerbruggen :)
from toast-phonegap-plugin.
You are just God damn perfect ! Thank you @EddyVerbruggen
from toast-phonegap-plugin.
Related Issues (20)
- duration does not seem to accept values on "show" and "showWithOptions"methods (Android 8.0) HOT 17
- Android P doesnt display toast HOT 2
- Toast not shown in Honor 8XS HOT 14
- Toast is not showing in Android 9.0.0 (OnePlus 5) HOT 5
- Toast deprecation error on iOS 12.1.2 HOT 1
- why does the message have my app name before it pops up and how to remove it?
- What are advantages over web popover?
- iOS - Toast is displayed full width, no margins on left or right
- How can I increase the width and height of the toast?
- Android 9.0 Toast are not showing 2nd time HOT 1
- How is it possible to read Toast text?
- styling verticalPadding is not working properly in Android OS version 10 HOT 1
- Test0123
- null pointer exceptions in android 11 HOT 13
- window.plugins.toast.showWithOptions is not working
- Position of notification in Android 11 HOT 1
- Crash from API 30 HOT 7
- On Toast Click not working
- `showShortTop()` method is showing toast at the bottom only not at the top
- No color or styling For Android 12 and 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toast-phonegap-plugin.