Categories
React Native

React Native – EventEmitter removeListener Method has been deprecated

Warning: Receiving warning on the console.

removeListener Method has been deprecated

EventEmitter.removeListener(‘appStateDidChange’, …): Method has been deprecated. Please instead use remove() on the subscription returned by EventEmitter.addListener.
EventEmitter.removeListener(‘appStateDidChange’, …): Method has been deprecated. Please instead use remove() on the subscription returned by EventEmitter.addListener.
EventEmitter.removeListener(‘appStateDidChange’, …): Method has been deprecated. Please instead use remove() on the subscription returned by EventEmitter.addListener.

React Native Version 0.65+, removeListener is depreciated. You can use remove() isntead of removeListener

Example of React Native useEffect:

Another way to escape this warning

If you are sure that the deprecated use is happening in a dependency you cannot control, it is possible to silence these warnings. In your App.tsx or somewhere else add LogBox on that screen.

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.

Categories
React Native

React Native – Take a Tour – App Tour – Tap Target View

React Native Take a Tour – App Tour – Tap Target View library. This library is a React Native bridge around android and ios app tour libraries. Supported RN >= 0.61

In this article I have discuses how to show Tap Target View on React Native project Function based component. Please follow below steps to implement example code for Tap Target View on function based component.

Android: KeepSafe/TapTargetView
An implementation of tap targets from Google’s Material Design guidelines on feature discovery.

iOS: aromajoin/material-showcase-ios
An elegant and beautiful tap showcase view for iOS apps based on Material Design Guidelines.

Run following command to Install

After install react-native-app-tour I call event emitter DeviceEventEmitter

Now, we need to import react-native-app-tour module with below code.

Now define appTourSequence

Now we need to configure props for app tour targets.

Now configure and add view targets to appTourSequence. Here is example for view ref props like “ref={ref => this.payoutListMenuRef = ref}

When finish app tour sequence, we can execute our own code by using below onFinishSequenceEvent event.

React Native App Tour View full Example code. You can move the code on your own created screen.

Categories
React Native

React Native – Deep linking example for Android and IOS

In this article I will discuses how to configure Deep Link on React Native application. React Native provides a Linking to get notified of incoming links. React Navigation can integrate with the Linking module to automatically handle deep links. Deep linking and universal links are gateway into your mobile application.

Configure Deep Link on React Native Application:

Very first, you want to specify a scheme URL for your app. If your app scheme is appname then a link to your app would be appname://

URL scheme for your app:

Open your Android app manifest android/app/src/main/AndroidManifest.xml you need to add following code between activity and queries tags section.

Now configure the native iOS app to open based on the appname:// URI scheme. You need to add the following lines to ios/AppName/AppDelegate.m file.

After this change you need to re-build app “react-native run-android” or “react-native run-ios”

App Links Configure:

Here is configure app initial route and others screens with query params.

Configure App Linking:

Here is full example code for setup on App screen.

Test Deep Linking on IOS and Android:

Categories
React Native

React Native: Download or Save View Content as Image in gallery

In this article, I will show you how we can download or save loop view content as image in React Native. For download or save view inner content, you want to ensure that you have react-native-view-shot and @react-native-community/cameraroll its dependencies.

Install npm package for view-shot and cameraroll

Make sure view-shot and cameraroll linked with Xcode

Configure Download View Inner Content

Now we write a const variable viewRefs to set each view ref for each loop view item. Also I have used userDataList loop data object.
Now we write a const method const downloadImage = async (index) => {} to download and save loop view, each item.
Now we write a const method const getPermissionAndroid = async () => {} for Permissions storage, to save and download image. On my previous article I have explain how to Share View Content in loop each item.
Permission is required to read and write to the external storage. Open android/app/src/main/AndroidManifest.xml file and add those permissions to save or download image.
React Native Download and Save View Content full Example code:

Here is full code for Download and Save view content loop items using React Native. You can move the code on your own created screen.

Done, now run your app using following command:

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.

Categories
React Native

React Native: Share view content in loop or Share list each item

In this article, I will show you how we can share view content with other apps in React Native. To use this share view inner content, you want to ensure that you have react-native-view-shot and react-native-share its dependencies.

Share view content in loop

Installation Sharing View Inner Content

Now we write a const variable viewRefs to set each view ref for each loop view item. Also I have used userDataList loop data object.

Now we write a const method const shareImage = async (index) => {} to share loop view, eache item.

React Native Sharing View Content full Example code:

Here is full code for sharing view content with other apps using React Native. You can move the code on your own created screen.

Done, now run your app using following command:

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.

Categories
React Native

React Native: Form Validation Multiple Input Fields

In this article, I will show you how we can validate multiple input fields. On my previous article I have discus how to implement Multiple Input Fields with add more rows with React Native. In this article I will make first row inputs are require of multiple rows.

Validate Multiple Input Fields

If you don’t know how to validate React Native multiple input fields before submit form data. I hope this article can help you to validate multiple input fields.

Validate Multiple Input Fields

Now we write a function function validateFormMultipleFields() to validate multiple input fields.

Now we write another form submit handle method const handlePressSubmitButton = () => {} to validate multiple input fields when a user submit form data to API end point.

Validate Multiple Input full Example code:

Here is full code for validate multiple input fields with React Native. You can move the code on your own created screen.

Done, now run your app using following command:

Categories
React Native

React Native: Dynamic multiple input fields and add more field

In this article, I will show you how we can implement multiple input fields dynamically with add more rows on click on Add More button with React Native.

Dynamic Multiple Input Multiple Row

If you don’t know how to create this React Native dynamic multiple input fields, then hope this article can help you. In this example initially screen came with two row with 6 input fileds such as (UserId, StartAmount and EndAmount). We can added multiple row by click on add more rows. I have write another article to validate multiple inputs.

Here we defined first two rows with 6 input fileds with (userId, startAmount and endAmount) and each fields error key.

Here we added method for Add More form inputs lines.

Dynamic Multiple Input full Example code:

Here is full code with dynamic multiple input field example. You can move the code on your own created screen.

Done, now run your app using following command:

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.

Categories
React Native

React Native: Bottom Tabs Navigator

Bottom Tabs Navigator is simple tab bar on the bottom of the screen, you switch between different screen or routes. Routes are initialized all tab screen components, they are not mounted until first focused.

Bottom Tabs Navigator

Installation Bottom Tabs Navigator

To use this tab navigator, you want to ensure that you have @react-navigation/native and its dependencies.

Install vector icons library

React Native Bottom Tabs Navigation Example:
Now create new “screens” directory in application root directory.


Then you need to create some screen files like HomeScreen.js, LoginScreen.js, RegisterScreen.js, AboutScreen.js and ProfileScreen.js in screens directory. Or If you have already some screens than skip new screen creations.

Now, open App.tsx file form React Native application directory and add following code in your App file.

Done, now run your app using following command:

Your app is ready with bottom tabs navigation. More details Bottom Tabs Navigator click here.

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.

Categories
React Native

React Native: Top Tabs Navigator

Top Tabs Navigator is material-design themed tab bar on the top of the screen that lets you switch between different routes by tapping the tabs or swiping horizontally. Transitions are animated by default. Routes tab screen components for each route are mounted immediately.

Top Tabs Navigator

Installation Top Tabs Navigator

To use this tab navigator, you want to ensure that you have @react-navigation/native and its dependencies.

Installing dependencies into a bare React Native project

React Native Top Tabs Navigation Example:
Now create new “screens” directory in application root directory.


Then you need to create some screen files like HomeScreen.js, LoginScreen.js, RegisterScreen.js, AboutScreen.js and ProfileScreen.js etc. in your screens directory. Or If you have already some screens than skip new screen creation.

Example HomeScreen:

Now, open App.tsx file form React Native application directory and add following code in your App file.

Done, now run your app using following command:

Your app is ready with top tabs navigation. More details Material Top Tab Navigator click here.

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.

Categories
React Native

React Native: How to configure reactnavigation?

React Navigation is one of the most well-known navigation libraries available for React Native. In this article, I will discuse how to get started using React Navigation in a React Native application.

React Native Navigation

Installation ReactNavigation

Install the required packages vai (npm or yarn) in your React Native project:

Install Stack Navigator

Installing dependencies into a bare React Native project

React Native navigation example:
Now create new “screens” directory in application root directory.
Then you need to create some screen files like HomeScreen.js and LoginScreen.js in screens directory. Or If you have already some screens than skip new screen creation

HomeScreen.js.

LoginScreen.js

Now, open App.tsx file form React Native application directory and you need to wrap the whole app in NavigationContainer.

Done, now run your app using following command:

Your app is ready with two screens and move between screen by click button (Go to Login and Go to Home). More details Stack Navigator click here.

Thank you for carefully read my article If you have any query please Leave your query on following comment section or contact with us. Hope it will help you.