Posts

Showing posts from May, 2018

AsyncStorage in React Native

Image
Hey Guys!! Good Day!! AsyncStorage Component is a simple storage system, that is globally available to React Native Application. It is persistent, means data that has been stored will continue to exist even when quiting or restarting Application or your phone. Its also asynchronous, as its name implies.  The following are some of the main methods for AsyncStorage setItem getItem removeItem clear multiSet multiGet multiRemove Optionally, we can add a callback to the methods. To know more methods in AsyncStorage, refer AsyncStorage . setItem This method is to save key and its value in AsyncStorage.                   AsyncStorage.setItem('key', 'value')                                         .then( () =>{                                                 //Operation to do                                        }); getItem This method is to get the saved value, using its key.                    AsynStorage.getItem(

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',