Build custom state object with failed promises in React Native using axios...
I'm trying to build a custom state within a custom Hook (RN init, not expo)This state isinterface ResponseState { api1: { error: boolean; errorMsg?: string; data?: DataResponse; // interfaces/blablabla...
View ArticleJest + @testing-library/react-native Error: ReferenceError: You are trying to...
Overview:I made a custom input component in which I'll be able to add props and optional props when necessary, but running into an error (see below) when running npm run test. I'm using jest and...
View ArticleChange game without changing the games added before
Im consuming a json file with the some games.I want to add a new Game and the chooseGameToAdd() choose what game will be without changing the games added beforeJson file:Code:import { games as...
View ArticleReact-Native-Styled-Components: Property 'backgroundColor' does not exist on...
I am using react-native-Typescript for my app. My styled-components version is "styled-components": "^5.3.0". I have create custom ThemeProvider and wrap to my root app. I have have toggle dark theme...
View ArticleHow to check instance of parameters in function?
I have to different interfaceinterface Vehicle {// data about vehicle}interface Package {// data about package}I have a component that in it's props can receive either of them (and maybe more in the...
View Article'JSX' is not defined
This is my component:And there are two errors TypeScript is showingHow can I tell this function that it's going to be passed the children property which will be the JSX element or an array of JSX elements
View ArticleHow to add additional info to an image?
I am new to React and Ionic and builded the Ionic React photo gallery app with the help of this ionic tutorial. Now I also want to add additional info like its date, its location, some inputfields,......
View ArticleTest onPress button with Enzyme in React Native gives: "SyntaxError:...
I'm trying to test the onPress event inside this screen:const MyScreen = () => {return (<View><Button title="Confirm" onPress={()=>console.log('a')}/> </View>)}Here the...
View ArticlePassing function into context in react-native using typescript
const AuthContext = React.createContext<any>({ currentUser: null, signUp: null});export function useAuth() { return useContext(AuthContext);}export function AuthProvider({ children }) { const [...
View ArticleHow to create index.d.ts file in yarn package?
I have created yarn package, but I can't create index.d.ts file.This is my tsconfig.json:{"include": ["src/**/*"],"exclude": ["node_modules", "**/*.spec.ts"],"compilerOptions": {"target":...
View Articlecannot initiate expo bare workflow with typescript
I`m trying to initiate expo bare workflow with typescirpt.But after I type "expo init [project name]" in command window,I cannot find minimal(typescirpt) option.? Choose a template: » - Use arrow-keys....
View ArticleTypescript useState error boolean has no call signatures
I am using Typescript with React Native and I am having trouble with an error on the console. It says "This expression is not callable. Type 'Boolean' has no call signatures."The code is simple, it...
View ArticleReact native styled component conditional Props
I am using React-native typescript for my app. I am trying to make one custom setting screen. Custom Settings takes a data prop; an object that describes the content of settings. In the setting screen...
View ArticleSave value of inputfield into varialbe
I am trying to build a very basic LogIn screen atm as a starter project for the future.All is done in TypeScript and React Native.When i try to use OnChangeText function, email is not set to the value...
View ArticleTypeScript: How to combine DefaultTheme with styled-components?
I have a module that is made with styled-components and export a themeI want to combine the exported theme for styled from the module with my application theme.I have tried the following in...
View ArticleHow to navigate from linking (deep linking with branch.io) when navigator...
I pretty much followed both react-navigation deep linking and branch.io react-native documentation, and either both are deprecated or just not completely helpful.All I want is that whenever a deep link...
View ArticleHow to use forwardRef with FunctionComponent in React Native using TypeScript
I've looked at many of the docs and examples but I still can't seem to quite understand how to use forwardRef with a functional component with TypeScript in React Native. Below is an example where I...
View ArticleInvalid hook call. Hooks can only be called inside of the body of a function...
I am new to React native and I try to redirect after Facebook login bu I get the Invalid hook call. Hooks can only be called inside of the body of a function component . I Here is my code. Please give...
View ArticleHow to properly type useNavigation in React Navigation?
I'm trying to type the useNavigation from React Navigation. I would like to be able to pass only the name of the route, but I get an error unless I also pass props for that route.Following the...
View ArticleNesting object declaration
can someone help me with the following snippet.type Item = { id: number; size: number;}type Example = { name: string; items: [ Item ];}var obj: Example = { name: "test", items: [ { id: 1, size: 10 }, {...
View Article