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

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 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 Collapsible / Accordion / Expandable List View in React Native

This is an Example of Collapsible / Accordion / Expandable List View in React Native. To make a Collapsible / Accordion / Expandable View we will use react-native-collapsible library.

As a mobile application developer we always have a limited area to draw our imagination and in some cases, we have lots of data to show. To solve this issue we have a view called Collapsible View which show the important data on the top and if the user is interested in the content they can click to expand the view and can see the related data in detail.

This example will have Single Collapsible View, Selectors, and Accordion View.

For those who have heard Accordion for the first time; Accordion is frequently used in HTML which is like expandable list in mobile development.

Collapsible

Accordion

In this example, you will see

  1. Simple collapsible View.
  2. Accordion View (With Multiple/Single Expand).
  3. Selector Bar connects with Accordion View.

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 Collapsible and Accordion component you need to install react-native-collapsible and react-native-collapsible/Accordion package.

To install this open the terminal and jump into your project

Run the following command

We will use some animation to expand the view, for that you need to install react-native-animatable package.

To use Animatable component install using

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

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

                      

This is how you can make Collapsible / Accordion / Expandable ListView. 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. 🙂

Overlay ActivityIndicator / Progress Bar / Loading Spinner in React Native

This is an Example of Overlay ActivityIndicator / Progress Bar / Loading Spinner in React Native. This is the most common thing that we use in every application. We will use the react-native-loading-spinner-overlay library to make an overlay Loader. This is basically used to block the screen while the application is doing some work like fetching data from the server or processing any big data which needs some resources.

To make an Overlay ActivityIndicator we will use Spinner component provided by react-native-loading-spinner-overlay.

Spinner

In this example, we will make an overlay Spinner which will be visible in every 3 seconds using an interval function. 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 Spinner component you need to install react-native-loading-spinner-overlay 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-loading-spinner-overlay.

–save is optional, it is just to update the react-native-loading-spinner-overlay 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 Overlay ActivityIndicator/Progress Bar/Loading Spinner 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 React Native AutoComplete Input

This is an Example of React Native AutoComplete Input. To make an AutoComplete Input we will use Autocomplete component provided by react-native-autocomplete-input.

If you want to show some suggestions to the user while entering the value in an Input you can use AutoComplete Input, to show the hint you have to provide the data as a list or an array to the Autocomplete Input.

Autocomplete Input

In this example, we will make an Autocomplete Input which will show the suggestions of the movies name if we start typing something. 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 Autocomplete component you need to install react-native-autocomplete-input 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-autocomplete-input.

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

Dependency Version for this Example Used is

Now Open App.js in any code editor and the 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 React Native AutoComplete Input. 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. 🙂