How to create a string array in the useState hook and update that same array...
I have a React project where I am trying to create a multi select function where you can select and deselect multiple avatars at once.So far I have this:export interface IStoreRecommendationProps {...
View ArticleSave value from custom hook to state
I am trying to save a value from a custom hook, which is fetching data for the server, to functional component state with useState, because I later need to change this value and after the change it...
View ArticleCustom TextInput getting error with React.forwardRef?
I have a simple custom component as belowimport {View, TextInput} from 'react-native'interface ICustomProps extends TextInputProps { iconName?: WhateverType;}const CustomInput:...
View ArticleHow to type properly with ref?
I have a simple custom component as belowimport {View, TextInput} from 'react-native'interface ICustomProps extends TextInputProps { iconName?: WhateverType;}const CustomInput:...
View ArticleWhy arrow function name must be const/let?
I have a tsx file with react-native. My function name is underlined if function is not set to const or let with this message:Cannot find name 'goBack'goBack = () => { // do stuff}But it works if I...
View Article'Unnecessary' TS error upon providing a prop to a native ios component
I created a native module using Swift called CounterView, and when I use it as such:<CounterView style={{flex: 1}} />I get this nasty warning! But the thing is, everything works. The error goes...
View ArticleUsing types in Styled Component in Typescript
So, I'm working with React Native and never used Styled Components before.When I'm creating a new component without SC, such a custom button, I do the following:import React, { ReactNode } from...
View Articlehow to use `useQuery` to trigger api call only when onClick happens?
how can I use useQuery to trigger some api call only when onClick happens?I have an application that need to trigger api call, useAPICall with query data only when clicking button and function...
View ArticleESLint / Prettier / Husky indent problems in React-Native app
I have a problem, when I commit, I have Husky which checks for indentation errors / usual errors (like props are not used.... etc). My app is a TypeScript React-Native app.I am getting the following:...
View ArticleProperty 'email' does not exist on type 'Readonly'
I am getting this error in React Native TypeScript Project but the program is running Successfullythis error Occurs in VS CodeSo anyone can suggest to me what to do.i think so is there any extension...
View ArticleSimulate hardware back press in react-native test
The following post somewhat describes my issueHow to simulate android back button in react-native test but in my case I'm not actually using the BackHandler, but the onRequestClose prop on a modal.So...
View ArticleHow to change particular index of BarChart Bar Color using react native?
In my scenario, I am using react-native-svg-chart to displaying BarChart with only BarChart data. Here, general fill colour for BarChart I given in render. Now, I want to achieve bar-chart last index...
View ArticleHow to load array of data into dataset format using React Native?
In my-scenario, I am trying to format the dataset values. Here, I have an array of data that I want to load it into dataset format. Here are the below code, which I am loading manually. I want to do...
View ArticleSelecting button in React Native ButtonGroup
I have a small problem. I'm using a ButtonGroup which previously worked with two options but now I am offering 4 options.It renders correctly on the screen but I can only select the first two options....
View ArticleReact Navigation V5 + Typescript Error: Property 'fullName' does not exist on...
My Goal:I'm trying to add Typescript typings, but having an issue with route.params.fullName. When I console.log(route.params), the object { fullName: 'John Smith' } is logged. Why is Typescript having...
View ArticlePromise, async, await - Boolean returns false but if condition still gets called
ContextI have this piece of code to force app update, that checks whether an update is needed and is supposed to return true or false depending on the version number of the user's app vs the App Store...
View Articlereact navigation : useIsFocused usage fails test cases
I added the useIsFocused() to my file to accommodate focus event likefile.jsimport { useIsFocused, useNavigation } from "@react-navigation/native"const navigation = useNavigation() const isFocused =...
View ArticleIm trying to goBack to the root screen on my react native app but i cant, i...
I want to return to th login screen or just return all like when the app is oppened, i tried to use navigation.popToTop but it drop an error like popToTop was not handled by any navigator.The objective...
View ArticleProblems with react-native-svg-transformer and typescript
I decided to add typescript in a existing project and have a issue when a i works with import of .svg like a thisimport Icon from "../../../assets/Icon.svg";i tried configure metro.config.jsconst {...
View ArticleHow to use Try and Catch with Typescript
I want when the two arguments of function sum are numbers, the code success, but when one of the two arguments is not a number I want to throw an exception. const sum = (num1: number, num2: number)...
View Article