enchev / nativescript-dialog Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hey there!
Awesome package.
Our app was solely Objective-C until we added this package, and this was the first Swift package. The app binary increased by about 15MB because of this package, as all the Swift frameworks have to be included in the .ipa
itself.
Would an older version of SDCAlertView that wasn't Swift be usable?
Hi,
I try to set up the dialog for iOS, but I always get the following error when I try to close the dialog after an http request has finished:
TypeError: result.dialog.dismissAnimatedCompletion is not a function. (In 'result.dialog.dismissAnimatedCompletion(true, null)', 'result.dialog.dismissAnimatedCompletion' is undefined)
This is what I am doing:
exports.showActivityIndicatorDialog = function() {
if(platform.device.os === platform.platformNames.ios){
nativeView = UIActivityIndicatorView.alloc().initWithActivityIndicatorStyle(UIActivityIndicatorViewStyle.UIActivityIndicatorViewStyleGray);
nativeView.startAnimating();
} else if(platform.device.os === platform.platformNames.android){
nativeView = new android.widget.ProgressBar(application.android.currentContext);
nativeView.setIndeterminate(true);
nativeView.setPadding(0, 0, 0, 30); //left, top, right, bottom
}
dialog.show({
message: "Some message",
cancelButtonText: "",
nativeView: nativeView
}).then(function(result){
console.log(result);
});
};
exports.closeActivityIndicatorDialog = function() {
try {
dialog.close();
} catch(e) {
console.log(e);
}
};
So when any http-request in my app has finished, I try to call the closeActivityIndicatorDialog function.
My testing environment:
Everything works fine on Android. Does anybody know what is going wrong here on iOS?
Best regards,
Felix
Do to the fact that this repo is no longer maintained, and I re-ran in the issue in #15, we (nStudio) has decided to fork this and we will maintain it.
Repo: https://github.com/nstudio/nativescript-dialog
NPM: tns plugin install @nstudio/nativescript-dialog
Hey there,
So I see when there's no message set that the message field is still initialised on both iOS and Android with an empty string. This leaves a fairly obvious space between the title and the nativeView. The way I fixed it was by checking whether the message was set, and then setting the message rather than initialising it with an empty string. So:
for example on Android, rather than:
alert.setMessage(options.message || "");
I use:
if (options.message) {
alert.setMessage(options.message);
}
I'm not exactly sure if it's default behaviour on iOS, as removing the message doesn't seem to change anything.
the code in the sample doesnot work
android.widget not found
UIActivityIndicatorView not found
I try to use the ios and android in this document, not work
http://docs.nativescript.org/api-reference/classes/_ui_activity_indicator_.activityindicator.html#ios
Can the message and indicator be together on the same "row"? I'll attach an image when I get to my computer but they're on the same line in the apps I use. Trello, Twitter, Facebook. If you don't have the time to look into this I'll see about the android side, iOS I have no clue.
Is this possible? I'd like to use this on iOS due to the built in nativescript modal covering the whole screen. I have a page with some icons and text and I'd like to load this and use it in the nativeView component.
Are there any methods to remove the dialog from the UI? I didn't see anything in the .js files to do this. Thanks.
Oh and a huge ๐ for this, I've been trying to achieve this for a couple days with no luck.
When try to build sample app with Xcode 7.2 result is:
Swift._ContiguousArrayBuffer<A.Element> in ActionSheetView-D196E6E1AE053852.o
...
"_swift_slowAlloc", referenced from:
l_get_field_types_ActionCell in ActionCell-4FAA7E5C39EF3278.o
l_get_field_types_ActionSeparatorView in ActionCell-4FAA7E5C39EF3278.o
l_get_field_types_ActionSheetView in ActionSheetView-D196E6E1AE053852.o
l_get_field_types_UIGestureRecognizerState in ActionSheetView-D196E6E1AE053852.o
l_get_field_types_ActionsCollectionView in ActionsCollectionView.o
l_get_field_types_UICollectionViewScrollDirection in ActionsCollectionView.o
l_get_field_types_UIGestureRecognizerState in ActionsCollectionView.o
...
"_swift_slowDealloc", referenced from:
l_get_field_types_ActionCell in ActionCell-4FAA7E5C39EF3278.o
l_get_field_types_ActionSeparatorView in ActionCell-4FAA7E5C39EF3278.o
l_get_field_types_ActionSheetView in ActionSheetView-D196E6E1AE053852.o
l_get_field_types_UIGestureRecognizerState in ActionSheetView-D196E6E1AE053852.o
l_get_field_types_ActionsCollectionView in ActionsCollectionView.o
l_get_field_types_UICollectionViewScrollDirection in ActionsCollectionView.o
l_get_field_types_UIGestureRecognizerState in ActionsCollectionView.o
...
"_swift_unknownRelease", referenced from:
@objc SDCAlertView.ActionCell.titleLabel.setter : __ObjC.UILabel! in ActionCell-4FAA7E5C39EF3278.o
@objc SDCAlertView.ActionCell.(highlightedBackgroundView in _9D875CD50AFC0A29E6CC02B5D165BE76).setter : __ObjC.UIView! in ActionCell-4FAA7E5C39EF3278.o
@objc SDCAlertView.ActionCell.enabled.setter : Swift.Bool in ActionCell-4FAA7E5C39EF3278.o
SDCAlertView.ActionCell.enabled.setter : Swift.Bool in ActionCell-4FAA7E5C39EF3278.o
SDCAlertView.ActionCell.enabled.didset : Swift.Bool in ActionCell-4FAA7E5C39EF3278.o
SDCAlertView.ActionCell.highlighted.setter : Swift.Bool in ActionCell-4FAA7E5C39EF3278.o
SDCAlertView.ActionCell.highlighted.didset : Swift.Bool in ActionCell-4FAA7E5C39EF3278.o
...
"_swift_unknownRetain", referenced from:
@objc SDCAlertView.ActionCell.titleLabel.getter : __ObjC.UILabel! in ActionCell-4FAA7E5C39EF3278.o
SDCAlertView.ActionCell.titleLabel.getter : __ObjC.UILabel! in ActionCell-4FAA7E5C39EF3278.o
@objc SDCAlertView.ActionCell.titleLabel.setter : __ObjC.UILabel! in ActionCell-4FAA7E5C39EF3278.o
@objc SDCAlertView.ActionCell.(highlightedBackgroundView in _9D875CD50AFC0A29E6CC02B5D165BE76).getter : __ObjC.UIView! in ActionCell-4FAA7E5C39EF3278.o
@objc SDCAlertView.ActionCell.(highlightedBackgroundView in _9D875CD50AFC0A29E6CC02B5D165BE76).setter : __ObjC.UIView! in ActionCell-4FAA7E5C39EF3278.o
@objc SDCAlertView.ActionCell.enabled.setter : Swift.Bool in ActionCell-4FAA7E5C39EF3278.o
SDCAlertView.ActionCell.enabled.setter : Swift.Bool in ActionCell-4FAA7E5C39EF3278.o
...
"_swift_unknownWeakAssign", referenced from:
@objc SDCAlertView.ActionSheetView.(cancelActionView in _1A63DC1157DE00F3AB9B9EAE982FC99F).setter : weak __ObjC.UIView? in ActionSheetView-D196E6E1AE053852.o
@objc SDCAlertView.ActionSheetView.(cancelLabel in _1A63DC1157DE00F3AB9B9EAE982FC99F).setter : weak __ObjC.UILabel? in ActionSheetView-D196E6E1AE053852.o
@objc SDCAlertView.ActionSheetView.(cancelButton in _1A63DC1157DE00F3AB9B9EAE982FC99F).setter : weak __ObjC.UIButton? in ActionSheetView-D196E6E1AE053852.o
"_swift_unknownWeakDestroy", referenced from:
@objc SDCAlertView.ActionSheetView.__ivar_destroyer in ActionSheetView-D196E6E1AE053852.o
l_objectdestroy30 in AlertController.o
"_swift_unknownWeakInit", referenced from:
SDCAlertView.ActionSheetView.init (SDCAlertView.ActionSheetView.Type)(frame : __C.CGRect) -> SDCAlertView.ActionSheetView in ActionSheetView-D196E6E1AE053852.o
SDCAlertView.ActionSheetView.__allocating_init (SDCAlertView.ActionSheetView.Type)(frame : __C.CGRect) -> SDCAlertView.ActionSheetView in ActionSheetView-D196E6E1AE053852.o
SDCAlertView.ActionSheetView.__allocating_init (SDCAlertView.ActionSheetView.Type)(coder : __ObjC.NSCoder) -> SDCAlertView.ActionSheetView? in ActionSheetView-D196E6E1AE053852.o
SDCAlertView.ActionSheetView.init (SDCAlertView.ActionSheetView.Type)(coder : __ObjC.NSCoder) -> SDCAlertView.ActionSheetView? in ActionSheetView-D196E6E1AE053852.o
SDCAlertView.AlertController.(configureAlertView in _03556AC34B15272832C68ED974279B9D) (SDCAlertView.AlertController)() -> () in AlertController.o
"_swift_unknownWeakLoadStrong", referenced from:
@objc SDCAlertView.ActionSheetView.(cancelActionView in _1A63DC1157DE00F3AB9B9EAE982FC99F).getter : weak __ObjC.UIView? in ActionSheetView-D196E6E1AE053852.o
@objc SDCAlertView.ActionSheetView.(cancelLabel in _1A63DC1157DE00F3AB9B9EAE982FC99F).getter : weak __ObjC.UILabel? in ActionSheetView-D196E6E1AE053852.o
@objc SDCAlertView.ActionSheetView.(cancelButton in _1A63DC1157DE00F3AB9B9EAE982FC99F).getter : weak __ObjC.UIButton? in ActionSheetView-D196E6E1AE053852.o
SDCAlertView.ActionSheetView.prepareLayout (SDCAlertView.ActionSheetView)() -> () in ActionSheetView-D196E6E1AE053852.o
SDCAlertView.ActionSheetView.tintColorDidChange (SDCAlertView.ActionSheetView)() -> () in ActionSheetView-D196E6E1AE053852.o
@objc SDCAlertView.ActionSheetView.tintColorDidChange (SDCAlertView.ActionSheetView)() -> () in ActionSheetView-D196E6E1AE053852.o
function signature specialization <Arg[0] = Dead and Owned To Guaranteed> of SDCAlertView.ActionSheetView.actions.didset : [SDCAlertView.AlertAction] in ActionSheetView-D196E6E1AE053852.o
...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing first 200 notices only
** BUILD FAILED **
The following build commands failed:
Ld /Users/nsbuilduser/workspace/tns-plugins-build-testapps-dialog-stable/demo/platforms/ios/build/emulator/SDCAlertView.framework/SDCAlertView normal i386
(1 failure)
Command xcodebuild failed with exit code 65
It looks like http://www.openradar.me/23857648
In order to fix this may be {N} cli should be able to pass something like:
destination 'platform=iOS Simulator,name=iPhone 6,OS=latest'
When using this an a loading dialog people may need to update the message. Having an updateMessage method would be nice. Also the ability to not have the alert cancel if you click offscreen.
I want to add buttons with images and style to the buttons. How can I do so and how to position the prompt to anywhere on screen.Thanks
Current version (0.1.0) works on Android.
On iOS, I'm getting ReferenceError: Can't find variable: SDCAlertController
My code:
var dialog = require("nativescript-dialog");
var nativeView;
if(platform.device.os === platform.platformNames.ios){
nativeView = UIActivityIndicatorView.alloc().initWithActivityIndicatorStyle(UIActivityIndicatorViewStyle.UIActivityIndicatorViewStyleGray);
nativeView.startAnimating();
} else if(platform.device.os === platform.platformNames.android){
nativeView = new android.widget.ProgressBar(application.android.currentContext);
nativeView.setIndeterminate(true);
}
dialog.show({
title: "Loading...",
message: "Please wait!",
cancelButtonText: "Cancel",
nativeView: nativeView}
).then(function(r){ console.log("Result: " + r); },
function(e){console.log("Error: " + e)});
Error log from promise rejection, on iOS
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.