Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
cordova-plugin-actionsheet
Advanced tools
Show a sheet of options the user can choose from.
UIActionSheet
AlertDialog
Popup
iOS
Android
Windows Phone 8
$ cordova plugin add cordova-plugin-actionsheet
$ cordova prepare
ActionSheet.js is brought in automatically. There is no need to change or add anything in your html.
ActionSheet works with PhoneGap build too! Just add the following xml to your config.xml
to always use the latest version of this plugin:
<plugin name="cordova-plugin-actionsheet" />
ActionSheet.js is brought in automatically. Make sure though you include a reference to cordova.js in your index.html's head:
<script type="text/javascript" src="cordova.js"></script>
Check the demo code to get you going quickly, or copy-paste some of the code below to replicate the ActionSheets of the screenshots above.
Also, wait for deviceready
to fire before using plugins in general!
var callback = function(buttonIndex) {
setTimeout(function() {
// like other Cordova plugins (prompt, confirm) the buttonIndex is 1-based (first button is index 1)
alert('button index clicked: ' + buttonIndex);
});
};
function testShareSheet() {
var options = {
androidTheme: window.plugins.actionsheet.ANDROID_THEMES.THEME_DEVICE_DEFAULT_LIGHT, // default is THEME_TRADITIONAL
title: 'What do you want with this image?',
subtitle: 'Choose wisely, my friend', // supported on iOS only
buttonLabels: ['Share via Facebook', 'Share via Twitter'],
androidEnableCancelButton : true, // default false
winphoneEnableCancelButton : true, // default false
addCancelButtonWithLabel: 'Cancel',
addDestructiveButtonWithLabel : 'Delete it',
position: [20, 40], // for iPad pass in the [x, y] position of the popover
destructiveButtonLast: true // you can choose where the destructive button is shown
};
// Depending on the buttonIndex, you can now call shareViaFacebook or shareViaTwitter
// of the SocialSharing plugin (https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin)
window.plugins.actionsheet.show(options, callback);
};
function testDeleteSheet() {
var options = {
'addCancelButtonWithLabel': 'Cancel',
'addDestructiveButtonWithLabel' : 'Delete note'
};
window.plugins.actionsheet.show(options, callback);
};
function testLogoutSheet() {
var options = {
'buttonLabels': ['Log out'],
'androidEnableCancelButton' : true, // default false
'winphoneEnableCancelButton' : true, // default false
'addCancelButtonWithLabel': 'Cancel'
};
window.plugins.actionsheet.show(options, callback);
};
On iOS, you can also position the actionSheet origin by adding position: [100, 200]
If for some reason you want to hide the actionsheet programmatically, do this:
// options and callbacks are optional, so either approach will work:
window.plugins.actionsheet.hide();
window.plugins.actionsheet.hide({}, onSuccess, onError);
iOS and WP8 code: Eddy Verbruggen
Android code: mostly Brill Papping
subtitle
(iOS) and destructiveButtonLast
preferences. Also, iOS now uses the newer UIAlertController
instead of UIActionSheet
.<meta charset="utf-8" />
to your html file.Español
as a title or button label.actionSheet.showFromRect
method)Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Show a sheet of options the user can choose from.
The npm package cordova-plugin-actionsheet receives a total of 9,246 weekly downloads. As such, cordova-plugin-actionsheet popularity was classified as popular.
We found that cordova-plugin-actionsheet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.