Android material design using React Native

Example of Bottom Sheet (Material Design) in React Native

This is an Example of Bottom Sheet (Material Design) in React Native. To make a Bottom Sheet we will use BottomSheet component provided by react-native-btr.

Bottom Sheet was firstly introduced in android material design and became very popular. Different people use bottom sheet differently but the simple example which can be seen in day to day life is when you share something. When you share any data application opens a bottom sheet to ask you “share via”. We will make the same demo with the bottom sheet in this example.

Bottom Sheet

In this example, we will make a button to open a bottom sheet which has some social icons. We will use react-native-elements to make social icons.

Social Icon

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

For installation of the dependencies, open the terminal and jump into your project using.

Run the following commands

1. For BottomSheet component you need to install react-native-btr package.
Run the following command for the installation

2. We are going to use SocialIcon component to show the Social icons so for that you have to install react-native-elements and react-native-vector-icons dependencies.
Run the following commands for the installation

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

Linking of Dependencies

After installing the dependencies you need to link it with your project using

After linking the dependency if you face  Could not Compile Settings File project/android/settings.gradle error while building and installing the project then you can find the solution here.

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 example of Bottom Sheet 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 Card View using react-native-paper

Here is an example of React Native Card View using react-native-paper. If you want to explore some more options to make a Card View you can visit our previous post on React Native Card View.

For this example, we are using Card component provided by react-native-paper.  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

Open the terminal and jump into your project using.

To use Card we need to install react-native-paper packageTo install this 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-paper.

–save is optional, it is just to update the react-native-paper 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 Card View using react-native-paper. 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 Card View for Android and IOS

Here is an example of React Native Card View for Android and IOS using react-native-elements. To make a React Native Card View we have a Card component provided by the React Native elements but we can also use other libraries too as there are many options available. For this example, we are using Card component provided by react-native-elements. 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 Card you need to install react-native-elements and react-native-vector-icons dependencies.

To install these dependencies 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.

Linking of Dependencies

After installing the dependencies you need to link it with your project using

After linking the dependency if you face  Could not Compile Settings File project/android/settings.gradle error while building and installing the project then you can find the solution here.

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 Card View. 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 SnackBar – Bottom Flash Message

Here is an example of React Native SnackBar. We will use react-native-snackbar-component to generate Snackbar in React Native.

React Native SnackBar is a completely new way to show alert to the user. While using an Alert dialog we block the user’s visible area and force him to click on the screen to continue but in case of SnackBar, we show a small strip below the screen by adjusting the view. it comes up from the bottom (we can also remove it after a certain time). It also has an action text which will help you to perform some action. For an example, you have seen Gmail App which notifies you after removing the Emails and gives you an action button also to revert your action.

 

Sample code for SnackBar

In this example, we will show the Snackbar on a click of a button and will generate an alert while clicking on the action button of Snackbar. 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 Snackbar in our project we have to import react-native-snackbar-component library.

To install the library open the terminal and jump into your project

Now 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-snackbar-component.

–save is optional, it is just to update the react-native-snackbar-component 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).

Android

          

IOS

          

That was the React Native SnackBar. 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 Floating Action Button

Here is an example of React Native Floating Action Button. It was first introduced in Android Material Design. When we have to show a ListView and also need a button on the same screen we can use Floating Action Button. Gmail App is the best example where you can see the Floating Action Button. To make a Floating Action Button we are using TouchableOpacity with the trick in StyleSheet.

The position property specifies the type of positioning method used for an element.
There are five different position values:

  • static
  • relative
  • fixed
  • absolute
  • sticky

Elements are then positioned using the top, bottom, left, and right properties. However, these properties will not work unless the propertyposition is set first. They also work differently depending on the position value. An element with position: absolute; is positioned relative to the nearest positioned ancestor (instead of position relative to the viewport, like fixed).

For more about the position, you can visit here. Though it is a link to show the CSS position it will work in React Native in the same manner. To start with this example

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).

               

That was the React Native DatePicker Floating Action Button. 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 Swipe Down to Refresh List View Using Refresh Control

Here is an example of React Native Swipe Down to Refresh List View Using Refresh Control. It was first introduced in Android Material Design and became very popular. Almost all Apps are using Swipe down to refresh. In React Native you can use this feature using RefreshControl provided by React Native.

To Import Refresh Control in Code

Swipe Down to Refresh List View Using Refresh Control

In this example, we will make a simple list which is having from the network call and we can refresh the data using swiping down. 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.

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 React Native Swipe Down to Refresh ListView Using RefreshControl. 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 Collapsible Toolbar with Animation

Here is an example of React Native Collapsible Toolbar with Animation. It was first introduced in Android Material Design and became very popular. In Collapsible Toolbar when screen renders for the first time we got the broad header which will help us to get the attention of the user on important details. As the user scrolls up header goes up with the screen and collapses itself because this time the focus of the user is on the data below the header and again when the user pulls the screen down it expands and become broad again.

In this example of Collapsible Toolbar, we are using Animated a React Native component which helps us to manage our toolbar. 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.

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 Collapsible Toolbar with Animation. 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 View Pager with 3 Different Indicators

This is an Example of React Native View Pager with 3 Different Indicators. React Native View Pager allows the user to flip left and right through pages. In our ViewPager Example, we’ll implement a ViewPager that swipes through three different views with the indicator.

  1. PagerDotIndicator
  2. PagerTabIndicator
  3. PagerTitleIndicator

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 PagerTabIndicator, IndicatorViewPager, PagerTitleIndicator, PagerDotIndicator you need to install rn-viewpager 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 rn-viewpager.

–save is optional, it is just to update the react-navigation 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 ViewPager. 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. 🙂

Bottom Navigation with Navigation Icon from Local Directory

Here is an example of Bottom Navigation with Navigation Icon from Local Directory. This post is an extension of my previous post on How to Make React Native Bottom Navigation with Latest Navigation V. 3+.

In this example, we are making the same layout and flow as the previous one, Bottom Navigation with navigation options like Home and Setting. Each screen has other navigation options too but this time the navigation tab icon will be from the local directory.

This example will work for the React Navigation Version 3+. If you are using Version 2+ then please find the comments in the code for the suitable changes or can see our old post React Native Navigation Version 2+ for the help.

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

To use createStackNavigator you need to install react-navigation and react-native-gesture-handler dependencies.
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.

Linking of Dependencies

After installing the dependencies you need to link it with your project using

After linking the dependency if you face  Could not Compile Settings File project/android/settings.gradle error while building and installing the project then you can find the solution here.

Project File Structure

To start with this Example you need to create

  1. A directory named pages in your project and create four files DetailsScreen.js, HomeScreen.js, ProfileScreen.js and SettingScreen.js in it.
  2. A directory named asset which will have our icons stored.

      

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

App.js

Open pages/DetailsScreen.js in any code editor and the Replace the code with the following code.

DetailsScreen.js

Open pages/HomeScreen.js in any code editor and the Replace the code with the following code.

HomeScreen.js

Open pages/ProfileScreen.js in any code editor and the Replace the code with the following code.

ProfileScreen.js

Open pages/SettingsScreen.js in any code editor and the Replace the code with the following code.

SettingsScreen.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 Bottom Navigation. 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. 🙂

How to Make React Native Bottom Navigation with Latest Navigation V. 3+

Here is an example of React Native Bottom Navigation. Bottom Navigation is very useful when you have 2-3 main navigation options. It provides the user with easy access to regular usable options.

In this example, We will make a Bottom Navigation with navigation options like Home and Setting. Each screen has other navigation options too. So let’s get started.

This example will work for the React Navigation Version 3+. If you are using Version 2+ then please find the comments in the code for the suitable changes or can see our old post React Native Navigation Version 2+ for the help.

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 createStackNavigator you need to install react-navigation and react-native-gesture-handler dependencies.
Run the following commands

2. We are going to use Ionicons to show the menu icons from react-native-vector-icons/Ionicons. So to install react-native-vector-icons run the following command

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.

Linking of Dependencies

After installing the dependencies you need to link it with your project using

After linking the dependency if you face  Could not Compile Settings File project/android/settings.gradle error while building and installing the project then you can find the solution here.

Project File Structure

To start with this Example you need to create a directory named pages in your project and create four files DetailsScreen.js, HomeScreen.js, ProfileScreen.js and SettingScreen.js in it.


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

App.js

Open pages/DetailsScreen.js in any code editor and the Replace the code with the following code.

DetailsScreen.js

Open pages/HomeScreen.js in any code editor and the Replace the code with the following code.

HomeScreen.js

Open pages/ProfileScreen.js in any code editor and the Replace the code with the following code.

ProfileScreen.js

Open pages/SettingsScreen.js in any code editor and the Replace the code with the following code.

SettingsScreen.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

(Home menu with details screen in it)

    

IOS

(Home menu with details screen in it)

    

Android

(Setting menu with detail and profile screens in it)

           

IOS

(Setting menu with detail and profile screens in it)

          

In this example, we have used Ionicons for the bottom navigation tab icons. If you want to use the icons from the local directory of your project then please visit our next post on Bottom Navigation with Navigation Icon from Local Directory. This will be a similar example but the bottom tab icon will be from the project’s local directory.

That was the React Native Bottom Navigation. 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. 🙂