Example of Calendar with Events Listed in React Native

This is an Example of Calendar with Events Listed in React Native. To make a Calendar with Events in React Native we have a EventCalendar component provided by react-native-events-calendar.

In this example, you can add the events in a calendar using an event array. You just need to pass the date and time (or some other elements if you want) of the event as a JSON array and this will show you all the events on the calendar. You can use click on the calendar event to get the further details of the event.

EventCalendar

In this example of Calendar with Events, we will make a calendar with some event listed from a dummy event array. If you want you can use web-services to fetch the data as an array from the server and pass that array in events prop of  EventCalendar. So Let’s get started.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Installation of Dependency

To use EventCalendar component you need to install react-native-events-calendar package.

To install this Open the terminal and jump into your project

Run the following command

This command will copy all the dependencies into your node_module directory. –save is optional, it is just to update the react-native-events-calendar dependancy in your package.json file.

Dependency Version for this Example Used is

Now Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

That was the Example of Calendar with Events Listed in React Native. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

React Native Get Current Time in 12 hours Format AM PM

This is an Example of React Native Get Current Time in 12 hours format AM PM. In this example, we get the Current time in 12 hours format. We will use momentjs which is very helpful when you deal with the date and time.

To Get Current Time in 12 hours Format

  • moment() will return the current date time.
  • utcOffset is used to set your time zone.
  • format will decide the output format.

For Time Format:

  • Y/YYYY -> Year
  • M -> Month in single digit(Ex. 8)
  • MM -> Month in double-digit(Ex. 08)
  • MMM -> Month short name (Ex. Aug)
  • MMMM -> Month full name (Ex. August)
  • D -> Day in single digit(Ex. 5)
  • DD -> Day in single double-digit(Ex. 05)
  • HH -> Hours in 24 hr format
  • hh -> Hours in 12 hr format
  • mm -> Minutes
  • ss -> Seconds
  • a -> am/pm

Let’s get started.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Installation of Dependency

To use moment you need to install moment dependency.

To install this dependency open the terminal and jump into your project

Run the following commands

This command will copy all the dependencies into your node_module directory. –save is optional, it is just to update dependencies in your package.json file.

Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

This is how you can get the current time in 12 hours format(in AM/PM format). If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

React Native Get Current Date Time

This is an Example of React Native Get Current Date Time. In this example, we will get the Current Date and Time. We can Easily get the Current Date, Month, Year using Date function.

To Get Current Date and Time

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

This is how you can get the current date and time. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

Example of React Native Timer and Stopwatch

This is an Example of React Native Timer and Stopwatch. To make a Stopwatch and Timer we have a very good library called react-native-stopwatch-timer. It will provides Stopwatch and Timer component.

React Native Timer and Stopwatch

A Stopwatch is a special watch which can be used to count the time. In stopwatch time starts from zero and run until we stop it but Timer is the exact opposite of it. In the Timer, we decide the time to count and it counts towards zero.

Stopwatch

Timer

In this example, we will make a Stopwatch and a Timer. The Timer will show the count down from the given Millisecond.  So Let’s get started.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Installation of Dependency

To use Stopwatch and Timer you need to install react-native-stopwatch-timer package.

To install this open the terminal and jump into your project using

Run the following command

This command will copy all the dependencies into your node_module directory, You can find the directory in node_module directory named react-native-stopwatch-timer.

–save is optional, it is just to update the react-native-app-intro-slider dependancy in your package.json file.

Dependency Version for this Example used is

Now Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

          

That was the React Native Timer and Stopwatch. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

React Native CountDown Timer using react-native-countdown-component

This is an Example of React Native CountDown Timer using react-native-countdown-component. A CountDown Timer is the reverse of the timer we usually see.  To make a CountDown Timer we will use CountDown component from react-native-countdown-component.

CountDown Timer can be used if you are making an App which has some time constraints like if you are making a quiz App, You need some sort of timer to show the remaining time. Let’s see the example below.

In our Example, we will make a CountDown Timer which will show the Count Down from the Expiry DateTime to the Current DateTime. If you want to make a simple quiz app using this you can directly pass the time for the CountDown Timer in seconds. We have used a library called moment which is very helpful if you are playing around the Date and Time.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Installation of Dependencies

To install dependencies open the terminal and jump into your project

1. To use CountDown you need to install react-native-countdown-component dependency.

To install this run the following command

2. To use moment you need to install moment.

To install this run the following command

These commands will copy all the dependencies into your node_module directory.

–save is optional, it is just to update the react-native-countdown-component and moment dependancies in your package.json file.

Dependency Version for this Example used is

Now Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

Android

IOS

 

That was the React Native Count Down Timer. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

Example Showing the Working of Calendar Picker in React Native

This is an Example Showing the Working of Calendar Picker in React Native. Calendar Picker can be used to select the date range (Start Date to End Date). For the Calendar Picker that can be used on both platforms, you need to use a react-native-calendar-picker library.  A single React Native Calendar Picker component for both Android and IOS.

In this Example, We will make a Calendar Picker which will have the feature to select a date range and will show the starting and ending date on a Text. So let’s get started.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Installation of Dependencies

To use CalendarPicker you need to install react-native-calendar-picker package.

To install this open the terminal and jump into your project using

Run the following commands

This command will copy all the dependencies into your node_module directory, You can find the directory in node_module directory named react-native-calendar-picker.

–save is optional, it is just to update the react-native-calendar-picker dependancy in your package.json file.

Dependency Versions for this Example used are

Now Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

IOS

Android

That was the React Native Calendar Picker. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

Example to Use Time Picker in React Native

This post will show you an Example to Use Time Picker in React Native. TimePicker can be used to select the time. For the TimePicker that can be used on both platforms, you need to use a react-native-simple-time-picker library.  A single React Native timePicker component for both Android and IOS.

In this example, we will make a simple time picker with default time and the user can change the time. So let’s get started.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Installation of Dependency

To use timepicker you need to install react-native-simple-time-picker package.

To install this open the terminal and jump into your project

Run the following command

This command will copy all the dependencies into your node_module directory, You can find the directory in node_module the directory named react-native-simple-time-picker.

–save is optional, it is just to update the react-native-simple-time-picker dependancy in your package.json file.

Dependency Version for this Example used is

Now Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

IOS

Android

That was the React Native TimePicker. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂

Working with Date Picker in React Native

In post Working with Date Picker in React Native we will see how to make a Date Picker using DatePicker Component from react-native-datepicker library. This post will give you a basic idea about the Date Picker and how to make a Date Picker for your React Native app which can be used on Android and IOS both.

DatePicker Component from react-native-datepicker is a single React Native Date Picker component for both Android and IOS, using DatePickerAndroid, TimePickerAndroid, and DatePickerIOS.

In this example, we will make a simple date picker with default date passed by us and user can choose any date by clicking on it. So let’s get started.

To Make a React Native App

Getting started with React Native will help you to know more about the way you can make a React Native project. We are going to use react-native init to make our React Native App. Assuming that you have node installed, you can use npm to install the react-native-cli command line utility. Open the terminal and go to the workspace and run
npm install -g react-native-cli
Run the following commands to create a new React Native project
react-native init ProjectName
This will make a project structure with an index file named App.js in your project directory.

Installation of Dependency

To use DatePicker you need to install react-native-datepicker package.

To install this open the terminal and jump into your project using

Run the following command

This command will copy all the dependencies into your node_module directory, You can find the directory in node_module directory named react-native-datepicker. –save is optional, It updates the react-native-datepicker dependancy in your package.json file.

Now Open App.js in any code editor and replace the code with the following code.

App.js

To Run the React Native App

Open the terminal again and jump into your project using.
cd ProjectName
To run the project on an Android Virtual Device or on real debugging device
react-native run-android
or on the iOS Simulator by running
react-native run-ios (macOS only).

Android

     

IOS

 

That was the React Native DatePicker. If you have any doubt or you want to share something about the topic you can comment below or contact us here. There will be more posts coming soon. Stay tuned!

Hope you liked it. 🙂