Questions tagged [react-navigation-v6]
Version 6 of the routing and navigation library for Expo and React Native apps.
262
questions
42
votes
6
answers
16k
views
'Stack.Navigator' cannot be used as a JSX component
There is a type issue using react navigation, when use Stack.Navigation or Stack.Group from createNativeStackNavigator
The issue saids that the types dont match with JSX.element at the end of the ...
12
votes
1
answer
7k
views
React Navigation 6 (RN6) - Card stack within a modal
I have a question about a card stack inside a modal stack as illustrated in the attached image.
So, just to repeat what I wanted to do. I have a screen with the option presentation: 'modal' that opens ...
11
votes
1
answer
5k
views
Type error in getting route params within nested navigator using Typescript [react-navigation v6]
Having a navigation type definition as bellow, when I navigate from e.g AOne to BTwo with id:99 the console log of props.route.params shows correct info. But props.route.params.id throws type error
...
8
votes
5
answers
16k
views
WARN Sending `onAnimatedValueUpdate` with no listeners registered
I got stuck. I am developing a mobile application with React Native CLI & React Navigation 6.x Then when i use material top tabs navigator, swiping through left to right or right to left. It ...
8
votes
0
answers
1k
views
Organize screen/group structure in react navigation v6
I am trying to migrate an old react navigation v4 to v6 (more than 100 routes).
But I am facing to how to find the best structure to split group of screens in separate file/component.
I have tried ...
8
votes
1
answer
2k
views
React navigation v6 Modal with ScrollView inside - swipe down modal when top scrollview reached
I have a problem with the modal-presentation of react-navigation v6 to present a modal with ScrollView inside of it.
Actually if I enable gesture to swipe down the modal, it doesn't work if there is a ...
7
votes
2
answers
8k
views
useEffect is not called when navigating back to screen - React Navigation
I have a screen that makes a call to an api to fetch some data which is then displayed
An issue that I am seeing is that when I navigate away from the screen (I am using react-navigation 6.x) and then ...
7
votes
8
answers
12k
views
How to hide tabBar in specific Screen in React Navigation 6?
How to hide tabbar in specific screen in react-navigation 6 ... Without changing navigation structure as it's the only option available in the docs here
7
votes
0
answers
791
views
React navigation 6 headerRight truncated if title is too long
I updated my application to React Navigation 6.
In all of my screens I customised the headerBackImage, and added some headerRight with a Text.
In React Navigation 5, if the headerTitle was too long, ...
6
votes
1
answer
18k
views
react-native-safe-area-context throw `Unresolved reference:` error
While trying to upgrade react-native-navigation I got the following error, after upgrading react-native-safe-area-context
Note: Recompile with -Xlint:deprecation for details.
e: /home/me/myProject/...
6
votes
1
answer
371
views
Impossible to have two menu on the same screen
The goal
I'm trying to achieve a screen that looks like this. There are two menus, one is the burger menu created by createDrawerNavigator from react-navigation (top left corner).
The other menu is ...
6
votes
1
answer
1k
views
How to overwrite global RootParamList in react-navigation v6
In the upgrade guide to react-navigation v6:
https://reactnavigation.org/docs/upgrading-from-5.x/#ability-to-specify-a-type-for-root-navigator-when-using-typescript
it states that you can use
declare ...
6
votes
1
answer
2k
views
Sharing screens over multiple stacks/navigators in react-native using react-navigation v6
I have a few screens which i want to share among multiple stacks. I found a similar problem on github but with no working solution. When navigating to a shared screen i want to be able to go back to ...
5
votes
4
answers
14k
views
Possible to hide tab navigator from screen in stack nested in tab?
I have a Stack Navigator with some screens and an initial route like "Profile", and when I navigate to "Options" via a navigation.navigate("Options") from the "...
5
votes
6
answers
13k
views
React Navigation: Force screen to animate from left to right
With React Navigation v6.x and using the .navigate() function, new views always animate from right to left.
Typically this is fine, but I have a couple views that I always want to load from the left.
...
5
votes
5
answers
4k
views
screenOptions:{{tabBarHideonKeyboard: true}} not Working
When I am using custom tab bar through tabBar function tabBarHideOnKeyboard does not work but without tabBar function it works fine, any ideas on how I can make it work using tabBar function as well.
5
votes
3
answers
1k
views
React navigation - react native - How to block drawer in Stack Navigator nested inside Drawer Navigator?
In my react native app I have a stack navigator nested inside a drawer navigator. I want the drawer to be disabled in the stack navigator pages. I'm using react navigation 6.
In the docs (https://...
5
votes
1
answer
1k
views
React Navigation V6 using useCallback inside useFocusEffect issue invalid-hook-call
React navigation V6 documentation shows examples of using useCallback inside useFocusEffect. However when I use the same code, I encounter invalid-hook-call.
link: https://reactnavigation.org/docs/use-...
5
votes
1
answer
2k
views
Why is my navigation ref not ready in React Navigation 6 with Redux?
In React Navigation 6, my research shows that to navigate without a prop I should make a reference and use createNavigationContainerRef. I'm able to pass down the screen name to my dispatch but for ...
5
votes
0
answers
1k
views
How to use cardStyleInterpolator in react navigation 6 in react native
According to the documention in version 6, we can use the cardStyleInterpolator like this
import { CardStyleInterpolators } from '@react-navigation/stack';
// ...
<Stack.Screen
name="...
4
votes
4
answers
2k
views
How to get rid of white flashes on navigation using @react-navigation/native and @react-navigation/native-stack
Whenever I navigate to another screen,the screen flashes white as the screen navigated to seems to fade in. I built the app to both have a light and dark mode; this would have been fine for light mode ...
4
votes
5
answers
3k
views
Navigating without the navigation prop - typescript typings
I'm trying to include React Navigation 6.x into a React Native project with Redux and therefore need to be able to access the navigator from outside components.
I'm following this guide (Navigating ...
4
votes
2
answers
4k
views
React Navigation v6 usePreventRemoveContext is undefined error
TypeError: (0, _$$_REQUIRE(_dependencyMap[1], "@react-navigation/native").usePreventRemoveContext) is not a function. (In '(0, _$$_REQUIRE(_dependencyMap[1], "@react-navigation/native&...
4
votes
1
answer
3k
views
How do you implement React-native-gesture-handler with React Navigation 6.x Native Stack Navigator (RN>0.6)?
So, I am building a prototype android app as an internship project for a startup in React Native v0.66. I was new to RN but not React when I set up the project. My choice for navigation fell upon ...
4
votes
2
answers
2k
views
React-Native: tabLongPress event listener on react-navigation bottom tabs
I'm using @react-navigation/material-bottom-tabs and it works great!
How can I add the listener for the long press event on tab icons?
<Tab.Navigator ...>
<Tab.Screen
...
options={{
...
4
votes
0
answers
2k
views
Partially transparent modal overlay screen with previous screen in the background in react navigation 5 or 6?
We are currently using react-navigation (5.6) in our react native app.
We use a BottomTabNavigator as the root navigation.
const BottomTab = createBottomTabNavigator()
The individual screens under ...
4
votes
1
answer
3k
views
Swipe Gesture not working in React Navigation v6 in IOS build
I am using Expo SDK 43 and React Navigation v6 for my react native app. I have used React Drawer Navigation in my app navigation. In the development mode inside expo, drawer open and close functions ...
3
votes
3
answers
2k
views
Center the header title in drawer navigation
I am trying to center the title with Drawer Navigation. It's default behaviour on ios is center but for android it is moving to the left side just by the drawer. How to make it to the center of the ...
3
votes
4
answers
6k
views
How to prevent going back in React Native using React Navigation and 'beforeRemove' eventListener with custom modal?
What I want to achieve is straightforward. I want the user to be forced to confirm exiting a tab navigator called 'checkout'.
I read on React Navigation docs about preventing going back about the '...
3
votes
1
answer
3k
views
How to a full-width text input in header in React Navigation 6?
In my React Native (Expo) application, I wanted to upgrade React Navigation from V5 to V6. However, I could not make TextInput in stack navigator header full-width. I tried 'auto' and '100%' for the ...
3
votes
2
answers
2k
views
Deeplinking multiple paths for a screen in react-navigation 6+
I have some screens that need to support multiple deep linking paths like this:
export const navigationConfig = {
prefixes: supportedDeepLinkURLs,
config: {
screens: {
Root: {
...
3
votes
1
answer
2k
views
How to test deep links in react-navigation
I configured a deep link in react-navigation using the instructions on https://reactnavigation.org/docs/configuring-links#handling-nested-navigators. I have a few nested navigators so the linking ...
3
votes
1
answer
1k
views
How to refactor 'createSwitchNavigator' code in react-navigation-6?
Below is the code which uses react-navigation version-4. But in version-6 createSwitchNavigator is completely removed. How do I refactor the below code to make it work? I do not want to use the react-...
3
votes
3
answers
558
views
React navigation 6 - navigating from one stack A to stack screen B - why screen B wont call useEffect (but renders)?
I have a nested tabs navigator inside a stack navigator.
When I navigate from Tab Screen A to Stack Screen B, B's useEffect is called, all good.
When I navigate from Stack Screen C to also Stack ...
3
votes
1
answer
776
views
React Native - How to handle error The action 'NAVIGATE' with payload .. was not handled by any navigator?
Im trying to handle the error
The action 'NAVIGATE' with payload .. was not handled by any navigator
tried having a no route match. the documentation says:
const config = {
screens: {
Home: {
...
3
votes
1
answer
602
views
Typescript: Partial typing a react-navigation spy helper
(This is somewhat related to this three year-old post. I have tried to to follow the answers but they did not resolve my problem.)
I want to build a general mock (spy) navigator that I can pass in ...
3
votes
2
answers
2k
views
Testing React Native app: How to fix: navigation.setOptions is not a function?
Here is the test:
describe('<HomeScreen />', () => {
it('Renders correctly', () => {
// const setOptions = jest.fn(); // 1
// const setOptions = (navigation: any, route: any) => { } ...
3
votes
1
answer
337
views
How to adjust the screen animation speed of @react-navigation/material-top-tabs in react-navigation v6
I want to increase the animation speed. As I see in the documentation https://reactnavigation.org/docs/material-top-tab-navigator, there is no longer props like timingConfig or springConfig in react-...
3
votes
1
answer
2k
views
"Found screens with the same name nested inside one another" after upgrade to react-navigation v6
I've seen other people with the same issue but I can't get my code to work. After upgrading from RN 5 to RN 6, I get the error below.
Found screens with the same name nested inside one another. Check:
...
3
votes
0
answers
479
views
React Navigation - Dynamic Height of Container
I am trying to achieve a bottom sheet for a mobile app, with a navigation.
I am using react-native-bottom-sheet and react-navigation v6.
The react-native-bottom-sheet works fine with dynamic height, ...
3
votes
2
answers
3k
views
useFocusEffect runs every time useState updates
I've been trying to use useState inside useFocusEffect. Following react-navigation I got something like this:
const [counter, setCounter] = useState(0);
useFocusEffect(
useCallback(() => {
...
3
votes
0
answers
832
views
How can I align bottom tab navigation to bottom?
I am currently making custom bottom tab navigator because I had issues with the react native safe context where the black bar on the phone goes on top of the text on the bottom tab.
And I would like ...
3
votes
0
answers
2k
views
Back button doesn't show in React Navigation 6.x with nested navigators
My React Native app has a root Stack Navigator with some screens and nested navigators:
/* Root Stack Navigator */
const disableBackButtonOpts = {
headerBackVisible: false,
gestureEnabled: false
}
...
3
votes
1
answer
1k
views
React Navigation 6.x Header problem in bottom-tab
I have updated my dependencies to React Navigation 6.x
React Navigation 6.x says,
"Headers by default in Bottom Tabs & Drawer#
Developers often want to show a header for screens inside of ...
3
votes
2
answers
4k
views
How can I set the header height in React Navigation?
It seems like except backgroundColor nothing else has an effect in headerStyle.
const defaultNavOptions = {
headerBackTitle: 'Back',
headerStyle: {
backgroundColor: colors.secondary,
...
2
votes
1
answer
4k
views
How to fix this error: Check the render method of `DrawerNavigator`
When I navigate from signup screen to home screen I have got following error which is mentioned below. Where I have used the nested navigation in react native.
This is my app.js
import * as React from ...
2
votes
1
answer
4k
views
Reusing Stack with Group when nesting Navigation
Using React Navigation 6, in the documentation, they recommend you use Groups to minimize nested navigators.
However I'm not sure how to do that in this example, using a nested Stack in a Tab ...
2
votes
1
answer
4k
views
How to add a button on the bottomTabNavigator rather than navigating to a screen in react native?
I am using react-navigation 6. my requirement is to add a signout button in the bottom tab, I have a bottomTabNavigator. So, I want to add that button on the bottom tabs so as soon as it is pressed ...
2
votes
1
answer
1k
views
how to handle two drawers separately in react navigation 6?
I have created two Drawer Navigators
const MenuDrawerRight = createDrawerNavigator();
const MenuDrawerLeft = createDrawerNavigator();
function RightDrawerScreens() {
return (
<...
2
votes
1
answer
4k
views
React Navigation 6 : Remove screen which prevented by `beforeRemove` listener
I am new with React Navigation 6.
I have a screen with beforeRemove listener with a dialog to ask user to exit on confirmation.
My problem is the removing screen which prevented by beforeRemove ...