How to convert number to decimal in typescript?

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 Many times, we have to convert numbers to decimals to show value more attractive and informative to the user. TypeScript have toFixed() method to convert number spcfied decimal places. For example If we pass 2 in toFixed() method for 100 it will return 100.00 in string. let num : number = 100; num.toFixed(2); // '100.00' The toFixed() method also helps to define decimal places like if we have 23....

January 29, 2022聽路聽1 min聽路聽Infinitbility

How to convert string array to number array in typescript?

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 Today, we will learn how to convert string array to array of numbers in typescript. TypeScript have split() method which will make string to array but still all number in array in string. let strArr = string = "1,2,3,4,5,6,7,8,9,10"; strArr.split(","); // [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' ] Now, we know how to make array from string but we also want to convert value in number while converting string to array....

January 28, 2022聽路聽1 min聽路聽Infinitbility

how to remove curly braces from string in javascript?

Hello Friends 馃憢, Welcome to Infinitbility. Today, we are going to learn how to remove curly braces from string in javascript. To remove curly braces, we will use javascript replace() method and some regex code. Javascript replace() method also accept regex code to do the operation and we will write regex code to search curly braces global level in the string. Let鈥檚 take an example let str = "i'm {infinitbility}, and i provide example of {code snipest}"; Now, we have to remove all curly braces from string....

January 24, 2022聽路聽1 min聽路聽Infinitbility

How to check react native version in CMD?

Hello Friends 馃憢, Welcome to Infinitbility. Today, we are going to know how to check react native and react native cli version using CMD. To check react native version, React native CLI provide react-native -v commad to show react native and react native cli version. Let鈥檚 start steps to check react native version. Steps Open your CMD and navigate to your react native project. Run react-native -v command in your project folder....

January 20, 2022聽路聽1 min聽路聽Infinitbility

How to remove blank space from an array in javascript?

Hello Friends 馃憢, Welcome to Infinitbility. In this tutorial, we will see how we can remove spaces from an array in javascript. To remove space from the array we will use multiple javascript concepts like an iterated array, remove useless space, and falsy methods. JavaScript provides a filter() method to filter array elements by some condition, where we will write our space condition. filter() method returns a new array based on your condition....

January 19, 2022聽路聽1 min聽路聽Infinitbility

How to remove backslash from json object in javascript?

Hello Friends 馃憢, Welcome to Infinitbility. When we stringify JSON multiple times it will add slashes in JSON and that鈥檚 why many folks getting these errors. check the following example. let users = [ { id: 1, name: 'Infinitbility', email: '[email protected]' }, { id: 2, name: 'notebility', email: '[email protected]' }, { id: 3, name: 'stackbility', email: '[email protected]' }, ]; console.log(JSON.stringify(JSON.stringify(users))); console.log(JSON.stringify(JSON.stringify(JSON.stringify(users)))); Here, I have stringify double and triple times to check their output, and here is the result....

January 18, 2022聽路聽2 min聽路聽Infinitbility

How to remove an object from an array in javascript

Hello Friends 馃憢, Welcome to Infinitbility. When we are using arrays of objects and we have to remove objects from the array then there are no direct methods to remove them. Today, we will use javascript findIndex() and splice() methods to remove an object from an array using the object key. Let take the following sample arrays of objects. let users = [ { id: 1, name: 'Infinitbility', email: '[email protected]' }, { id: 2, name: 'notebility', email: 'notebility@gmail....

January 17, 2022聽路聽2 min聽路聽Infinitbility

How to check array contains value in react-native?

Hi Friends 馃憢, Welcome to Infinitbility. To check array contains value in react native, use the includes() method, it will return true or false based on array contains value or not. As a developer, we have many times needed to check values on having array values or not. Today, we will see how to check array contains a value or not in react native. Let鈥檚 see, what we are going to do...

January 16, 2022聽路聽2 min聽路聽Infinitbility

How to check android version in react native?

Hello Friends 馃憢, Welcome to Infinitbility. React native have multiple packages to get android version like Platform and react-native-device-info. Today, we will see how we can get an android version in react native. When you want to only the android version like tutorial topic then the Platform package is best for you. Platform package provides constant and Release one of them it will return device android version. Check the following example....

January 15, 2022聽路聽2 min聽路聽Infinitbility

How to remove item from json object in javascript?

Hello Friends 馃憢, Welcome to Infinitbility. To remove the item from a JSON object in javascript, use the delete keyword it will remove the key-value pair from an object only you have to mention the delete keyword with the key. JavaScript object is one of the most used concepts and we will use it every day almost but sometimes we need to delete some key-value pair. Today, we will see how we can remove items from the javascript object using a key....

January 14, 2022聽路聽1 min聽路聽Infinitbility

react-native-otp-input detox example

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 React Native detox tutorial 1. React native detox example 2. React native detox multiple typeText crash issues 3. React native detox with react navigation example 4. react-native-date-picker detox example 5. react-native-otp-input detox example Github source repo react-native-otp-input package not provides option to test by detox using testID but i have found some hack and i鈥檓 going to share with you guys. Today, we will learn how we can test react-native-otp-input using detox in react native....

January 13, 2022聽路聽1 min聽路聽Infinitbility

Javascript remove whitespace from beginning and end of string

Hello Friends 馃憢, Welcome to Infinitbility. Every time, when we take details from users they鈥檙e a lot of chances we will not get the same like we are expecting and space or white space is one of them. Today, we will see how we can remove white space at the start and end of the string. Before going to the solution, let discuss the solution that will help you on which conditions....

January 12, 2022聽路聽1 min聽路聽Infinitbility

react-native-date-picker detox example

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 React Native detox tutorial 1. React native detox example 2. React native detox multiple typeText crash issues 3. React native detox with react navigation example 4. react-native-date-picker detox example 5. react-native-otp-input detox example Github source repo As I researched, I haven鈥檛 got any example of react-native-date-picker detox example that鈥檚 why I tried myself and shared it with you guys. If anyone has better the following example, please share it in the comment section....

January 11, 2022聽路聽1 min聽路聽Infinitbility

How to show and hide password using eye icon in react native?

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 React Native provides an option to create password text input using secureTextEntry props but for the eye icon, we have to write some extra code to handle it. Today, we will see how we can implement an eye icon with toggle password functionality. In this tutotial, we are using react-native-paper for textinput and react-native-vector-icons for icons. Let start today鈥檚 tutorial How to show and hide password using eye icon in react native?...

January 10, 2022聽路聽1 min聽路聽Infinitbility

React native detox with react navigation example

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 React Native detox tutorial 1. React native detox example 2. React native detox multiple typeText crash issues 3. React native detox with react navigation example 4. react-native-date-picker detox example 5. react-native-otp-input detox example Github source repo When react-native navigate to another screen detox all test cases failed and now we start thinking about how to stop detox test cases execution when react-native navigate to another screen....

January 9, 2022聽路聽2 min聽路聽Infinitbility

React native detox multiple typeText crash issues

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 React Native detox tutorial 1. React native detox example 2. React native detox multiple typeText crash issues 3. React native detox with react navigation example 4. react-native-date-picker detox example 5. react-native-otp-input detox example Github source repo React native detox typeText works properly no matter how many times you are using it. Some developers write complex component render code like forwarding ref, dynamic rendering components, etc....

January 8, 2022聽路聽1 min聽路聽Infinitbility

How to show bullets in react native?

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 React Native does not provide <ol> and <ul> like tags which auto handle bullet and counts now we have to handle both <ol> and <ul> in React Native FlatList. For <ol>, we can easily show using index value but for <ul> we have to use some Unicode to handle it. As per Unicode when we use \u2B24 code to make round bullet code....

January 7, 2022聽路聽1 min聽路聽Infinitbility

React native detox example

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 React Native detox tutorial 1. React native detox example 2. React native detox multiple typeText crash issues 3. React native detox with react navigation example 4. react-native-date-picker detox example 5. react-native-otp-input detox example Github source repo Today, we will learn how to do end-to-end testing in react native and for end to end testing we wil use Detox devlop by Wix. This tutorial is part of React native detox series and in this first part, we will implement detox in react native application and write some test case examples....

January 6, 2022聽路聽4 min聽路聽Infinitbility

React hoverable menu example using CSS

Hello Friends 馃憢, Welcome To Infinitbility! 鉂わ笍 We use menu and submenus (dropdown) concepts on each react project for this we use some package like reactstrap or Material UI (MUI) but we can do this by using some simple CSS code also. Today, We write some CSS and HTML code in react to make hoverable menu and on hower we will show some sub menus also. Let start today鈥檚 tutorial React hoverable menu example using CSS...

January 5, 2022聽路聽2 min聽路聽Infinitbility

How to enable or disable scroll in flatlist react native?

Hello Friends 馃憢, Welcome to Infinitbility. Sometimes, we need to disable users scrolling content and you are also searching for how to enable or disable scrolling of react native flatlist then you are in right place. Today, we are going to do how to enable or disable flatlist scroll programatically. Basically, we will create a state isScrollEnabled and use in flatlist scrollEnabled props. React Native FlatList provide scrollEnabled props to handle scrolling of flatlist and we will pass our isScrollEnabled state value on it means when change isScrollEnabled true it will allow user to scroll and vice versa....

January 4, 2022聽路聽2 min聽路聽Infinitbility