Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Browsing all 6287 articles
Browse latest View live

React Navigation annotating useNavigator with BottomTabs

Can anybody help with typing / annotating useNavigator with RootStack -> Tabs -> Each tab has a stack setup.import { useNavigation } from '@react-navigation/native';import {...

View Article


React Navigation how to type TabNavigator with nested StackNavigators

I'm trying to properly type the following navigator. I have one successfully setup when it had a root StackNavigator, but I'm running into troubles when it has a BottomTabNavigator for the root. The...

View Article


Image may be NSFW.
Clik here to view.

Argument of type 'AnimatedValue' is not assignable to parameter of type...

I was going through React Native documentation for Animation: https://reactnative.dev/docs/animatedAnd wrote this simple codeimport {Animated as RNAnimated} from 'react-native'const ToastGeneric = ()...

View Article

Restrict importing specific named exports in TypeScript project

I have a react-native project I am building with TypeScript, and react-native exports an Alert class that takes some arguments and displays an alert message to the user. I needed an Alert component...

View Article

Access Child Screen Props From React Navigation Top Tabs

I'm using Typescript and since this question is more theoretical, I will only post the necessary code.I have a material top tab navigation looking like this:TabNavigator.tsxconst Tab =...

View Article


Cannot find module '@babel/runtime/helpers/interopRequireDefault' from...

I'm trying to build a mobile application with typescript, react-native, expo and jest. When I'm trying to run tests: FAIL src/components/Button/tests/Button.test.tsx● Test suite failed to run Cannot...

View Article

What is the correct way to specify type for a React Navigation drawer in...

I'm confused about how to explicitly type my Drawer Navigator in my TypeScript code.I can easily get things to behave as I expect, for example, in the following code. In particular the drawer-specific...

View Article

Type 'ListRenderItem' is not assignable to type 'ListRenderItem

why I get this error:Type 'ListRenderItem<IPhotos>' is not assignable to type 'ListRenderItem<unknown> Code:import { Dimensions, Image, ListRenderItem, Pressable, StyleSheet, Text, View }...

View Article


How do I publish an app to expo so that anyone can use it on expo go?

I'm just wondering how do I publish an app to expo so that anyone can use it on expo go? I've published one app on expo go but when I press "Open in expo go" it gives me an error saying something about...

View Article


Why I get this ts error when I want to add custom style to my image component?

I want to add my own style else I want to add an css image object. But I get this err:No overload matches this call. Overload 1 of 2, '(props: ImageProps | Readonly<ImageProps>): Image', gave the...

View Article

How to programmatically create a component and assign props to the passed...

i want to create a function that returns the component with the props i want to assign with it? something like this, a reusable component for Text/View/Pressable with extracted styles as props, i...

View Article

what is the best way to setParams to navigation before setting the options...

I wanna know the best way to set the params and options for react native navigation in a class component.note that the same params are used in options.when I put all code in the constructor I got...

View Article

TypeError: undefined is not an object (evaluating 'icons.map')

import { Text, TouchableOpacity, View,Image,StyleSheet } from 'react-native'import React , { Component,useState } from 'react'export const...

View Article


How to remove listner in the right way in react native navigation with class...

when I use removeListner function to remove the listner on navigation, I got a warning about that and that the remove not works correctly. componentDidMount() {...

View Article

Image may be NSFW.
Clik here to view.

React Native TypeScript WebSocket onerror Value of "this" must be of type Event

I'm trying to implement WebSocket support into my app by following React Native's own tutorial at https://reactnative.dev/docs/network#websocket-support.Here is my code:function...

View Article


Preferred TypeScript signatures for functional components in ReactNative?

I'm having trouble following the current views on the best practice for typing functional React Native components in TypeScript. I find many posts and threads that seem to start with one view and then...

View Article

Image may be NSFW.
Clik here to view.

Trying to create custom icon set in react-native(expo) but getting a...

I am trying to create my own Icon set in react native, but struggling with the types.Here is my code for Percolate.tsx file.import React, {FC} from 'react';import { createIconSet } from...

View Article


React Native navigation after successfully login

I have a ReactNative project with Typescript. In my project, I have used Firebase for authentication. I wanna redirect users after successful login.My Login screen structureInside of login screen, I...

View Article

How to get Typescript support for files imported using a local package.json

I'm adding package.json files in the main folders of my app to be able to import files easily, for example in constants folder there is a package.json file with {"name":"@constants"} and to import from...

View Article

Image may be NSFW.
Clik here to view.

How to create Menu with onPress attribute of TouchableOpacity

I want a profile picture uploading with the options: get image from camera (call getMediaFromCamera) on press or get image from gallery (getMediaFromImageLibrary)I have a TouchableOpacity but I want to...

View Article
Browsing all 6287 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>