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

How to Queuing Items to be added into React Native Context's State

I'm trying to show logs like console.log in my app UI using React Native Context. I have this codes in the context:...const [logs, setLogs] = useState<string[]>([]);const addToConsoleLogs = (log:...

View Article


Image may be NSFW.
Clik here to view.

React native absolute being hidden by parent

When I have an absolute scrollview inside of a view, where the view is position relative and the scrollview is absolute, the contents of the absolute scrollview are hidden outside of the view, this...

View Article


Trying to useEffect in react but my code does not work

I'm trying to change the left style attribute of the element when a change happens but my code does not work, do you know why?The Function Component:const Link: React.FunctionComponent<{ name:...

View Article

Image may be NSFW.
Clik here to view.

Return the value of a promise [duplicate]

Is there a way that we can return the value from a promise? I have this async/await function meant to retrieve the token from another async/await function getToken() but it only returns a promise...

View Article

React-native-image-picker camera doesn't open

I need to add image picker in my app. I've created small class for image picker logic:import {launchImageLibrary, launchCamera} from 'react-native-image-picker';export default class ImagePickerService...

View Article


Trying to set window height but it gives an error in react.js [duplicate]

I use useState to get the window height but it gives a runtime error saying that window is not defined. Do you know whyHere's the code:let [winHeight,setWinHeight] =...

View Article

Firebase httpsCallable emulator thwrowing unhandled promise rejection in...

I have a Firebase function that searches for a user by uid:export const findUserByUid = functions.https.onCall(async (data, context) => { const foundUser = await admin.auth().getUser(data.uid); if...

View Article

TextInput style Props type react native

I'm trying to pass style as props to my custom TextInput component.I found this snippet to type button and label style in props :import { StyleProp, Text, TextStyle, View, ViewStyle} from...

View Article


Trying to display links depending on hover but It doesn't work(react)

I'm trying to display different links when user hovers different buttons (in react.js) but it doesn't work. It gives an error like this: undefined is not an object (evaluating...

View Article


Image may be NSFW.
Clik here to view.

React Typescript: Cannot assign component to element

I need to map my JSX component(FC) inside an object for dynamic rendering.This is what I have come up with so far:Interface for Objectinterface Mappings { EC2: { component: React.FC<{}>; name:...

View Article

Email Validation in React Native using regx

I am using expo with React Native and I am trying to set error message when the email format is not validthis is my function: const emailValidator = (email: any) => { let reg =...

View Article

How to configure Jest to transform modules containing invalid syntax?

I've forked the following react native base project and converted it from JavaScript to TypeScript. The app runs correctly but Jest tests fail with the following error. I expected the test to run...

View Article

Convert useContext + userReducer (JavaScript) to Typescript

I'm trying to convert two files from JS to Typescript, but with no luck.The first file creates the reducer and actions to update the state.The second one is a file to create the context and map the...

View Article


How can I add a StyledComponent as a property to a another StyledComponent in...

This is what I'm trying to do. It works just fine in JavaScript but not in TSexport const Container = styled.View` align-items: center;`;Container.Title = styled.Text` font-family: Poppins-Regular;...

View Article

typescript not throwing error when passed an object that should throw

I have some code that I expect to throw an error that isn't in typescript and I'm not sure why. I have the following code in a react native project: const styles = { flexGrow: 1, width: '100%', } as...

View Article


React 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 Article

Understanding React Native with callback in type

I am new to react ( native) and typescript and do not fully understand what is the correct syntax for the below example from https://www.typescriptlang.org/docs/handbook/2/functions.html Call...

View Article


How to change the view color after pressing the TouchableHighlight?

In my scenario, I am having UI within render like below code. Here, whenever I am pressing the touchableHighlight then I need to change the color in multiple different mode. Here, Multiple...

View Article

axios post request in react native and react app with JSON Stringify and blob

I am making an app in which I am calling an API end point in react native but I am getting this error but in the web app (its done with react) it doesn't show any error, Here is the web app code in...

View Article

preview uploaded document in react native expo

I am trying to preview document in react native but nothing previewed when i click my Upload functionbut the image preview is successfully previewed, this is my functions:_pickDocument = async () =>...

View Article
Browsing all 6287 articles
Browse latest View live