bradmartin / nativescript-snackbar

:lollipop: :chocolate_bar: NativeScript plugin for Material Design SnackBar
Apache License 2.0
73 stars 12 forks source link

Snackbar is hidden by iOS keyboard. So using it for validation is tricky. #5

Open firescript opened 8 years ago

firescript commented 8 years ago

If we could set a position property, to maybe say bottom, or top. That would be useful. Just in cases where developers are using it to handle validation alerts.

bradmartin commented 8 years ago

I don't have much iOS knowledge so I'm not sure how we could handle this. Especially since we are using a cocoapod for the iOS version.

@sitefinitysteve - do you know of a way to handle this scenario?

firescript commented 8 years ago

I asked here as well: https://github.com/stonesam92/SSSnackbar/issues/6

sitefinitysteve commented 8 years ago

@bradmartin Howbdies android handle the scenario... Or does it

bradmartin commented 8 years ago

It doesn't from what I recall. I will check later.

On Fri, Jan 22, 2016, 9:33 AM Steve McNiven-Scott notifications@github.com wrote:

@bradmartin https://github.com/bradmartin Howbdies android handle the scenario... Or does it

— Reply to this email directly or view it on GitHub https://github.com/bradmartin/nativescript-snackbar/issues/5#issuecomment-173952346 .

bradmartin commented 8 years ago

It's not really the purpose of a Snackbar to use for validation. On a form you would use it for informing the user the form didn't submit successfully. With the option to resubmit. So the keyboard typically isn't open, but on android I believe the default works well with the keyboard being open. So if the cocoapod could just handle the keyboard the same, that would be good.

On Fri, Jan 22, 2016, 9:35 AM Brad Martin bradwaynemartin@gmail.com wrote:

It doesn't from what I recall. I will check later.

On Fri, Jan 22, 2016, 9:33 AM Steve McNiven-Scott < notifications@github.com> wrote:

@bradmartin https://github.com/bradmartin Howbdies android handle the scenario... Or does it

— Reply to this email directly or view it on GitHub https://github.com/bradmartin/nativescript-snackbar/issues/5#issuecomment-173952346 .

firescript commented 8 years ago

On android does it just slide up above the keyboard?

firescript commented 8 years ago

I just put in a PR that has support for show and showTop methods now. show() uses the bottom default way, and showTop() renders it at the top of the view.

https://github.com/stonesam92/SSSnackbar/pull/7

bradmartin commented 8 years ago

Great work.

On Fri, Jan 22, 2016, 2:01 PM Ryan Lebel notifications@github.com wrote:

I just put in a PR that has support for show and showTop methods now. show() uses the bottom default way, and showTop() renders it at the top of the view.

stonesam92/SSSnackbar#7 https://github.com/stonesam92/SSSnackbar/pull/7

— Reply to this email directly or view it on GitHub https://github.com/bradmartin/nativescript-snackbar/issues/5#issuecomment-174029800 .

sitefinitysteve commented 8 years ago

I think for this {N} plugin we should keep the "show" but pass in an optional position parameter... since it has to work on both platforms, internally android could just ignore.

bradmartin commented 8 years ago

Sounds good. Once they update the cocoapod, can one of you guys handle the update? I don't have a Mac to do test with (I know, I know... very sad).

On Sun, Jan 24, 2016, 11:44 AM Steve McNiven-Scott notifications@github.com wrote:

I think for this {N} plugin we should keep the "show" but pass in an optional position parameter... since it has to work on both platforms, internally android could just ignore.

— Reply to this email directly or view it on GitHub https://github.com/bradmartin/nativescript-snackbar/issues/5#issuecomment-174323085 .

sitefinitysteve commented 8 years ago

yepyep

sitefinitysteve commented 8 years ago

Although looks like android has a variant too? http://stackoverflow.com/questions/30585550/how-do-i-change-an-android-snackbars-initial-alignment-from-bottom-to-top

bradmartin commented 8 years ago

Yea I don't care to implement this, as it goes against the material design spec on what a Snackbar is. If you guys want to do it then that's fine as long as its an optional feature. It's just not an issue on android, if the cocoapod managed the layout according to the spec then putting it at the top wouldn't be an issue.

At any rate if you guys want it and have the time to implement it then thats great, I don't have the time right now and this isn't something I'm in favor or. However I respect you guys and if you want/need it then that gains my attention to make the plugin better :)

On Sun, Jan 24, 2016, 2:16 PM Steve McNiven-Scott notifications@github.com wrote:

Although looks like android has a variant too? http://stackoverflow.com/questions/30585550/how-do-i-change-an-android-snackbars-initial-alignment-from-bottom-to-top

— Reply to this email directly or view it on GitHub https://github.com/bradmartin/nativescript-snackbar/issues/5#issuecomment-174336811 .

bradmartin commented 8 years ago

Any update on the iOS stuff?

sitefinitysteve commented 8 years ago

Nope, looks like that pod is just orphaned atm :/ Leave this issue open though if you could

Obsessive commented 8 years ago

I think we can use this line of code to dismiss the keyboard without worrying about which view is the first responder.

In Swift UIApplication.sharedApplication().sendAction("resignFirstResponder", to:nil, from:nil, forEvent:nil)

In Objective-C [[UIApplication sharedApplication] sendAction:@selector(resignFirstResponder) to:nil from:nil forEvent:nil];

Obsessive commented 8 years ago

So before showing snackbar we can hide the keyboard

bradmartin commented 8 years ago

If one of the other iOS guys want to test and confirm this approach let's add it :)

On Thu, May 19, 2016, 9:50 AM Obsessive Inc notifications@github.com wrote:

So before showing snackbar we can hide the keyboard

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/bradmartin/nativescript-snackbar/issues/5#issuecomment-220348175