Posts

Showing posts with the label toast

Showing Alert and Toast - React Native

Image
Hey Guys!! Good Day!!! Hope you all are doing fine! Today let's learn about showing Toast message and Alert in React Native. These two components are some of the most important UI Components. So let's learn in detail. Alert: It displays an alert dialog with title and message. We can also add buttons to it to perform click operation, which in turn, fires onPress() event. In IOS, we can have any no. of buttons in it. But in Android, we can atmost have only 3 buttons. i.e., one Positive button(like 'Ok'), one negative button(like 'Cancel') and one neutral button(like 'Later'). Also In Android, by default, the alert will be dismissed by tapping outside of the 'Alert'. At that time, the event onDismiss() will be fired, where we can do any operation we need. In case, if you don't need that dismissible functionality, you can disable it by adding, { cancellable: false } Alert.alert('Title', 'Message here',