Skip to content
Advertisement

Tag: react-navigation

How to specify the type for the return of useNavigation

I’m having some diffuculties specifing the parameters for a function (onError) that receive the return of a useNavigation()) TS playground Answer I have not personally worked with @react-navigation, so I’m going by the types only, but it looks like useNavigation, when called without type parameters, defaults to ReactNavigation.RootParamList which doesn’t match your RootStackParamList. The non-extistent replace method comes from the

React Navigation navigation.navigate(“SomeScreen”) error in TypeScript

A common error which occurs in react-navigation, when using TypeScript, is: Argument of type ‘string’ is not assignable to parameter of type ‘{ key: string; params?: undefined; merge?: boolean | undefined; } | { name: never; key?: string | undefined; params: never; merge?: boolean | undefined; }’ What could this be caused by? Answer This occurs when types for specific

undefined is not an object (evaluating ‘navigation.navigate’) when trying to navigate to a file that will open camera on the phone

I’m trying to navigate to my page “CameraPage.js” but I’m getting this error “undefined is not an object (evaluating ‘navigation.navigate’)”. Can anybody see the problem? This ismy first question here so please tell me if I can be more specific. Here’s my App.js: Here is my CameraPage.js file: Here is my navigation file: Answer Your navigation container must be wrapped

React native Context API react-navigation

React native: ^0.64.0, @react-navigation/native-stack: ^6.1.0 @react-navigation/bottom-tabs: 6.0.5 @react-navigation/native: 6.0.2 I have a login screen. If the user passes the login screen the app leads the user to a the main part of the app. This is is the MainScreen with a bottom tab bar. The bottom tab bar gives the user the option to move between EditProfileScreen, SetupsScreen & TipsScreen.

Press tab to scroll to top of flatlist

I would like to implement scrolling to top. My tab is a flatlist, and when users scroll down the flatlist, they have to scroll back up. Instagram and Twitter allow you to press the tab to scroll back up, I am wondering how to implement it in my own app. Here is the tab I want to implement scrolling to

Advertisement