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

Reference Type Within itself, TypeScript

I'm trying to pass types (screen param types) to a field based on the value (screenName) entered.This is the navigation prop.export interface IEditProfileStackNavigatorProps<RouteName extends keyof...

View Article


Image may be NSFW.
Clik here to view.

How to debug React Native project created with Expo using TypeScript

I created an Expo boilerplate project that is using TypeScript.When I run the app with expo start, the Chrome debugger opens up at http://localhost:19001/debugger-ui/, but in the devtools I can only...

View Article


Displaying two Array items in Picker View

I am new to react and i want display array item into pickerview for selectionNOTE : Consider i can not modify structure of both the API_URL and env constonly way i can access the value is...

View Article

Why my export function call every time on change TextInput

HI there here is my code in react and type script Why this console.log , calls every time that my text filed change trigger ..export default function TabOneScreen({ navigation,}) { const [out_1,...

View Article

The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use...

I am trying to customize my imports using babel. I am following this link:https://medium.com/@leonardobrunolima/react-tips-working-with-relative-path-using-create-react-app-fe55c5f97a21This is my...

View Article


How to use react-native-testing-library getByRole

I'm trying to use getByRole in react native testing library but can't for the life of me figure out the syntaxComponent in question-<Text accessibilityRole={'button'} accessibilityLabel={'upvote...

View Article

VSCode react native no import errors detected in code

I have been using vscode for couple of years but recently with version 1.45 i don't see any errors detected while i code . For example , it does not validate whether the import statement is valid nor...

View Article

Change image url using ternary operator when a condition is met

When the user shakes the phone I want to change an image, and let it stay rendered that way. With this I can change the image but it goes back once the condition is not fulfiled:function...

View Article


How can I add a testId attribute to a React Native component for Testing...

I'm writing a React Native components using TypeScript and testing them with React Native Testing Library.I want to put a testId attribute on a React Native component like so:<TextInput testId="foo"...

View Article


Image may be NSFW.
Clik here to view.

Type issue in Typescript React-native styled-component

I am trying to create a TouchableOpacity using styled-component in react-native and was working successfully but since i am using typescript its showing some error when using style flowDirection:...

View Article

Changing interface depending on string input

I saw something cool within the React Navigation type.d.ts file and wondered how I could recreate some of the functionality.It's this line I'm trying to understandexport declare type...

View Article

Proper Typescript type for a reused screen in react-navigation v5

For most of the cases, I follow a simple pattern to type any screen under react-navigation v5:// Params definitiontype RouteParamsList = { Screen1: { paramA: number } Screen2: undefined}// Screen1type...

View Article

Image may be NSFW.
Clik here to view.

Typescript React | Adding 'as const' on variable has different behavior in...

I know I've added react-native even though this is really just a reactjs question.The codeconst ScreenStates = { DEFAULT: 0, ERROR: -1, SUCCESS: 1,} as const;type State = { currentState: typeof...

View Article


How to rewrite this function to a interface?

My goal is to write everything in interface, TypeScript. It's for React Native.This is the function I am unable to put into an interface. The current solution is to put it outside the interface but the...

View Article

TypeError: null is not an object (evaluating...

I am trying to get wifiname by using react-native-wifi-reborn library but when i try to implement methods which are mention in github page of this library but its getting error.can any one tell me how...

View Article


Typescript picks wrong interface for type checking for React Native component...

Some of my classed do not pass type checking by ESLint with Typescript because of this error: Object literal may only specify known properties, and 'selectedIndex' does not exist in type '{ zoomLevel:...

View Article

Image may be NSFW.
Clik here to view.

React native with typescript - how to use the useRoute from...

I'm trying to get my incident object from route.params but I don't know how to do it to make typescript recognize this prop.Here is the function that navigate to my Detail page passing incident to...

View Article


Return json object from resolved promise and assign it after it is loaded

I have a method in a class which returns JSON object and then outside the class in a function I create an instance of this class, call one of the methods and expect to read returned JSON values. But...

View Article

React Native SectionList: What are the correct TypeScript types

I'm building a React Native app using TypeScript. I'm trying to use a SectionList. I followed the docs, and here is my code: renderSectionHeader = ({ section: { title } }: { section: { title: string }...

View Article

Module not found. Can't resolve 'assets/styles/constants'

I've wanted to add Expo in my React Native project to start it in web browser. After doing that, I try to import file 'assets/styles/constants.ts'. This is my tsconfig.json:tsconfig.jsonThis is...

View Article
Browsing all 6287 articles
Browse latest View live


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