After finishing Beginners.

Example of Tooltip in React Native for Android and IOS

This is an Example of Tooltip in React Native for Android and IOS using react-native-walkthrough-tooltip library. The Tooltip is a common graphical user interface element. It is used to show the usability of any button or any option.

In this example, we will see how to show a tooltip on a click of a button. So let’s get started.

Import Tooltip using

To Show Tooltip

For this example, we will make a screen with 1 buttons using TouchableHighlight and on the click of the button we will change the visibility state of Tootip to make it visible.

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 Tooltip we need to install react-native-walkthrough-tooltip dependency.

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

Run the following command to install

This command will copy all the dependency into your node_module directory.

–save is optional, it is just to update the react-native-walkthrough-tooltip dependency 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

     


This is how you can make a Tooltip in React Native for Android and IOS using react-native-walkthrough-tooltip. 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 Touchable using react-native-platform-touchable

This is an Example to Make React Native Touchable using react-native-platform-touchable. We have already seen 4 Different Type of React Native Touchable in our last post in Beginner section. Here we will talk about the React Native Touchable.

React Native Touchable is built into React Native core which is a wrapper around the various Touchable* components in order to use TouchableNativeFeedback whenever possible.

If we talk about Android devices TouchableNativeFeedback  provides the Native experience but it is only supported by the Android and not supported by iOS, So in case of iOS we generally use TouchableOpacity as an alternative solution for the iOS.

In the above situation we have two choices either we use a common Touchable which is TouchableOpacity (Best for both platform) or identify the platform and then apply the Touchable accordingly. If you want to use the first method then its OK, you can proceed with that but if you want to provide the Native experience to your App users then you should go for the second one which makes the code lengthy (not much but a little bit).

react-native-platform-touchable library bought a simple component Touchable for the second case mentioned above. It is a wrapper over various Touchables which makes  the life very easy. You just have to install the dependancy and you are good to go. It will handle all the conditions and will use the Touchable according to the platform to provide the best experience.

For iOS:

TouchableOpacity with default activeOpacity.

For Android:

TouchableNativeFeedback with background from Android app style for Android API <= 20

TouchableOpacity for Android < 5.0

In this example, we will make a simple button with Touchable component to show the rendering of different Touchables according to different platform. So let’s get started.

Import using React Native Communication

To Make Touchable

For this example, we will make a home screen with 1 buttons using Touchable.

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 Touchable we need to install react-native-platform-touchable dependency.

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

Run the following command to install

This command will copy all the dependency into your node_module directory.

–save is optional, it is just to update the react-native-platform-touchable dependency 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


This is how you can Make React Native Touchable using react-native-platform-touchable. 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. 🙂

Make Phone Call, Send SMS or Email Using React Native Communication

This is an Example to Make Phone Call, Send SMS or Email Using React Native Communication. We will use the Communications Component provided by react-native-communications. This is a very easy to integrate library which can be used for very useful task like Making phone calls, Sending Text SMS or for Sending Emails.

Most important point to note here is that all the things will trigger the respective applications to handle the task like when we call a function to make a phone call it will open Dialer application with prefilled number supplied by us from our App. Similar with the SMS and mail.

In this example, we will see 4 types of different activity:

  1. Make Phone Call.
  2. Send SMS.
  3. Send Email.
  4. Open a web URL in  browser.

Now let’s get started with the example.

Import using React Native Communication

Here are the code snippets to perform above mentioned activities:

Make Phone Call

Send SMS

Send Email

Open a web URL

For this example, we will make a home screen with 4 different buttons to make a call, to Send SMS, to Send Email and to open a URL in browsers.

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 Communication we need to install react-native-communications dependency.

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

Run the following command to install

This command will copy all the dependency into your node_module directory.

–save is optional, it is just to update the react-native-communications dependency 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

          

This is how you can Make Phone Call, Send SMS or Email Using React Native Communication. 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. 🙂

Different Type of Modal Box in React Native

This is an Example of Different Type of Modal Box in React Native. We will use the Modal Component provided by react-native-modalbox. Modal Box is a React Native component which very easy and fully customizable. It has also implemented the ‘swipe down to close’ feature.

A modal is a dialog box/popup window that is displayed on top of the current page.

Modal Boxes are very useful to provide important pieces of information, to take input or to make some selection from a small chunk of data on the same screen.

In this example, we will see 7 Types of different Modal Boxes:

  1. Basic Modal.
  2. Top Modal.
  3. Center Modal with Cancel Disable/Enable.
  4. Bottom Modal.
  5. Modal Open/ Close Using State.
  6. Bottom Modal with ScrollView.
  7. Modal with Input.

Basic Modal

Top Modal

Center Modal with Cancel Disable/Enable

Bottom Modal

Modal Open/ Close Using State

Bottom Modal with ScrollView

Modal with Input

For this example, we will make a home screen with 7 different buttons to open the different types of Modals.

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 Modal we need to install react-native-modalbox dependency.

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

Run the following command to install

This command will copy all the dependency into your node_module directory.

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

IOS

Android

            
      

This is how you can use Different Type of Modal Box 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. 🙂

Linear Gradient Component in React Native

This is an Example of Linear Gradient Component in React Native. For those who have no idea about Gradient, A Gradients let you display smooth transitions between two or more specified colors. The gradient can be of two types:

  • Linear Gradients (goes down/up/left/right/diagonally)
  • Radial Gradients (defined by their center)

In this example, we will see the Linear Gradient. To Make a Linear Gradient in React Native we will use LinearGradient component from @react-native-community/react-native-linear-gradient provided by react-native-community. This is very useful if you want to make a custom button with a curve effect or any multi-color background.

In this example, we will make three buttons (Note: It is not only for the buttons you can use gradient in any view) with three types of gradient background:

  1. Simple Linear Gradient.
  2. Horizontal Gradient.
  3. Location Gradient.

Simple Gradient

Horizontal Gradient

Location Gradient

Here are some additional props for knowledge:

  1. colors: An array of at least two color values that represent gradient colors. Example: [‘red’, ‘blue’] sets gradient from red to blue.
  2. start: An optional object of the following type: { x: number, y: number }. Coordinates declare the position that the gradient starts at, as a fraction of the overall size of the gradient, starting from the top left corner. Example: { x: 0.1, y: 0.1 } means that the gradient will start 10% from the top and 10% from the left.
  3. end: Same as the start, but for the end of the gradient.
  4. locations: An optional array of numbers defining the location of each gradient color stop, mapping to the color with the same index in colors prop. Example: [0.1, 0.75, 1] means that first color will take 0% – 10%, second color will take 10% – 75% and finally third color will occupy 75% – 100%.

I think this is enough for now let’s get started with the 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.

Installation of Dependency

To use LinearGradient we need to install react-native-linear-gradient dependency.

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

Run the following command to install

This command will copy all the dependency into your node_module directory.

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

Linking of Dependency

After installing the dependency 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).

Case:

If you’re having trouble, you can point your package.json at GitHub to see if the issue has been fixed. Simply change the dependency

to get the data right from GitHub instead of npm and then npm install.

IOS

Android

This is how you can use Linear Gradient Component 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. 🙂

Make a Blur Background in React Native

This is an Example to Make a Blur Background in React Native. To Make a Blur Background in React Native we will use BlurView component from @react-native-community/blur provided by react-native-community. This is very useful if you want to make a splash screen.

In this example, we will make a simple screen with a Switch to switch between simple and blurred screen and three buttons to switch different type of blur effects. So let’s get started.

Make BlurView using

Different Type of Blur Effects:

  1. xlight: Extra Light Blur Type
  2. light: Light Blur Type
  3. dark: Dark Blur Type
  4. extraDark: Extra Dark Blur Type(tvOS only)
  5. regular: Regular Blur Type (iOS 10+ and tvOS only)
  6. prominent: Prominent Blur Type (iOS 10+ and tvOS only)

Adjust Blur Intensity:
0-100 – Adjusts Blur Intensity
Note: The maximum blur amount on Android is 32, so higher values will be clamped to 32.

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 BlurView we need to install @react-native-community/blur dependency.

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

Run the following command to install

This command will copy all the dependency into your node_module directory.

–save is optional, it is just to update the @react-native-community/blur dependancy in your package.json file.

Linking of Dependency

After installing the dependency 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.

Note: Please add the following lines for Android

(Android only) Add the following to android/app/build.gradle

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

         

This is how you can Make a Blur Background 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. 🙂

Turn on/off Flashlight to Make a Torch App in React Native

This is an Example to Turn on/off Flashlight to Make a Torch App in React Native. To Turn on/off the Flashlight in React Native we will use the react-native-torch library.

In this example, we will make a simple screen with a button to turn on the flashlight. So let’s get started.

Turn On the Flashlight using

Turn Off the Flashlight using

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 Torch we need to install react-native-torch dependency.

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

Run the following command to install

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

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

Linking of Dependency

After installing the dependency 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

This is how you can Turn on/off Flashlight to Make a Torch App 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. 🙂

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

Example of Searchable Dropdown / Picker in React Native

This is an Example of Searchable Dropdown / Picker in React Native. To make a Searchable Dropdown in React Native we have a SearchableDropdown component provided by react-native-searchable-dropdown.

React Native Picker is the component which can be used as a drop-down but in case of huge data we have to give the facility to search for the option for that we can use Searchable Dropdown.

Searchable Dropdown in React Native

In this example of Searchable Dropdown, we will make 2 searchable drop-downs. One of them will have the data from the static array and the other one have the data from calling the rest API. 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 SearchableDropdown component you need to install react-native-searchable-dropdown dependency.

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 directory named react-native-searchable-dropdown.

Dependencies for this example

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 the searchable dropdown/picker 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. 🙂

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