Dismiss Alert in React-Native - react-native

I was wondering if it is possible to dismiss an Alert in React-Native from the main application itself, programmatically?
As an example, my application shows an Alert. When the user stays on that screen for a while and the session of the app expires, the user gets redirected to the login screen but the Alert stays open and I'd like to close it while this happen.
Is there a way to do something like this?
Thanks

You can't. You have to use a custom alert box or a modal and than close it if needed.

Related

black bar above tableview after segue

I have an application that has an login-flow. In this login flow you have the possibility to remember your login and password onto your iPhone. When I do this and I restart the app I get a black bar between my tableview and my navigation bar. For mor clarification you see here a screenshot of my storyboard.
And you can see a screenshot of the problem over here.
So when does this happens. When I first start the app and I enter my login and pwd. Everything is OK. But when I save my login credentials on my phone. And restart the app. It skips the login screen and immediately goes to the tabbar. And at that moment the black bar appears.
Does anybody know what the problem can be?
Kind regards
Dont Skip the login screen, just check if the login is saved then show the add a View (Loading View with UIActivity indicator) but on the background of that View use to User save credentials to login again. and when you will successfully login then Hide the added View. This is surely help you

How to find out style of NSUserNotification during run-time? Or force close an alert?

According to OS X Mountain Lion Release Notes:
"The user has ultimate control over what notifications are displayed, and the style (banner, alert, etc). There is no mechanism to override the user preferences."
Even though all I want to do is "downgrade" from alert style to banner style... Fine. But can I at least find out whether a notification is of alert or banner style inside the didActivateNotification method?
When the alert is a banner (which is what I want), clicking its contents is the only possible action, and this both triggers didActivateNotification method with notification.activationType value of NSUserNotificationActivationTypeContentsClicked and closes the notification banner. I want my app to respond to this action by opening an internet URL.
When the user chooses alert-style notifications, clicking the alert contents also generates didActivateNotification with the same value of notification.activationType, but it stays on screen instead of going away (it only goes away when the Action button is pressed, and notification.activationType has a different value then). I don't want my app to trigger an action repeatedly for the same alert notification, in case the user clicks the content area of an alert notification.
An alternative solution would be to force the alert notification bubble to dismiss when the user clicks its contents. Is this possible?
You can remove the notification with the following:
[[NSUserNotificationCenter defaultUserNotificationCenter] removeDeliveredNotification:notification];

Can I show a UIAlertView as a banner (similar to push notifications) in iOS 5?

I am using a UIAlertView in my code in iOS5, but rather than the classic popup window with an "OK" button to exit, I'd prefer to have my alert show as a banner at the top of the screen that eventually fades away.
Is it possible to change the style of UIAlertView to resemble the iOS 5 push notification banner or does it have to be a popup window that must be dismissed manually? If not, is there any way to use the iOS5 banner notification rather than an alert notification? I don't need to send a push notification but just need to alert the user of something that happens on the server side using the app.
Not using the SDK. You'll have to design and implement that by yourself.
Have a look at:
http://cocoacontrols.com/platforms/ios/controls/mkinfopanel
http://cocoacontrols.com/platforms/ios/controls/jhnotificationmanager

Is there a notification on iOS if a UIAlertView is shown?

Wondering if there is a notification available if a UIAlertView pops up?
Background: my app asks the user for a PIN after a period of inactivity but I would like to prevent it if an alert is on screen.
I don't want to go through my code and find all alerts and disable the PIN checker, instead a notification would be awesome. Any hope with NSNotification?
Just found the answer. It is hidden in here:
Can I get message when I show UIAlertView
If you listen to the "UIWindowDidBecomeVisibleNotification" notification, it will also fire for your own alerts, not only for system alerts.
For your own alerts, the application does not resign activiation however.

Send app to background on button tap

In my apps there is a button named "Back". When the user clicks on that button, the apps should be sent to the background, like when we click on the home button.
Even if you manage to do this, it is against Apple's HIG (because it will look as a crash to the user) - if you plan to publish your app on the AppStore you'll be rejected.
I think turning to background is impossible.
Make user press home button by using UIAlertView with no cancel button.
We can send an application to the background using SpringBoardUI or the SpringBoardServices private frameworks.
However, Apple won't accept this on the App Store.