Skip to main content

All Questions

1 vote
0 answers
64 views

Mocking @react-navigation/stack GestureHandlerRefContext in Jest

I am using @react-navigation/stack and have Jest tests failing anywhere I am using the GestureHandlerRefContext in a component: TypeError: (0 , _native.createNavigatorFactory) is not a function >...
awsubtex's user avatar
0 votes
1 answer
514 views

React Navigation is not navigating to the screen when testing with React Native Testing Library and Jest

I have configured everything as described in the React Native Testing Library guide. Test case description - I load the home screen, tap on a list item in the home screen which navigates to the movie ...
Shubham Hande's user avatar
1 vote
0 answers
406 views

Testing with Jest in React Native Navigation with different Stacks depending on Redux State

I'm currently developing a React Native Expo app using Redux for state management and React Navigation for navigation. I'm trying to write Jest tests to ensure that the right screen is displayed based ...
Asaraspo's user avatar
1 vote
0 answers
1k views

createNativeStackNavigator is not a function when running Jest test

I am adding a Jest unit test for my hook useActiveInspectionProvider.test.tsx which is based on a Context/Provider wrapper. However, the react-navigation steps for setup appear to be a blocker for me ...
Phil Lucks's user avatar
  • 4,011
1 vote
1 answer
622 views

Jest giving error in React-Navigation while running UITest case in React-Native

While trying to run UI test in react native getting error from Jest. Updated the package.json file as well "jest": { "preset": "react-native", "setupFiles": [ ...
RahulSalvikar's user avatar
3 votes
1 answer
1k views

mockConstructor(...): Nothing was returned from render while testing Tab Navigator

I am trying to test my bottomTabNavigator and have followed the instructions here : https://callstack.github.io/react-native-testing-library/docs/react-navigation but I am getting this error ...
Thor0o0's user avatar
  • 407
0 votes
0 answers
1k views

Couldn't register the navigator. Have you wrapped your app with 'NavigationContainer'?

it('renders correctly', async () => { const tree = renderer .create( <TTopBar tabBarScrollEnabled={true} containerHeight={350} ...
Sunita Wali's user avatar
1 vote
0 answers
2k views

I can't render @react-navigation's NavigationContainer in tests using react native testing library

When I try to test my entire application, I'm receiving this error (full log at the end): Screen(...): Nothing was returned from render. This usually means a return statement is missing. Or, to render ...
Luiz Rodrigues's user avatar
2 votes
1 answer
789 views

Getting error while using useHeaderHeight() in unit-testing

Using @react-navigation/stack library in my project, while doing unit testing (using jest) I am getting this error Couldn't find the header height. Are you inside a screen in Stack? index.spec.js ...
Nikhil Tayal's user avatar
1 vote
1 answer
763 views

react-navigation 5 - how to test navigation event listeners using Enzyme + Jest (react native)

I have implemented a focus listener in my component like so (as shown in the react-navigation v5 documentation): componentDidMount() { const { navigation } = this.props this._unsubscribeFocus = ...
ArronK's user avatar
  • 33
1 vote
0 answers
307 views

Testing React-Navigation: how to check that screen is not focused (StackNavigator)

I'm trying to write tests for my react-native app that uses react-navigation (v6, but it doesn't matter). In the example below (copied from repo) I have 2 screens, and after navigating from ScreenA to ...
Shaddix's user avatar
  • 6,109
1 vote
0 answers
292 views

getting "TypeError: Cannot read property 'add' of undefined" error on testing with Jest

I am getting the following error in a test with jest: TypeError: Cannot read property 'add' of undefined at Object.<anonymous> (node_modules/@react-navigation/stack/lib/commonjs/utils/...
JaioSkura's user avatar
2 votes
0 answers
2k views

SyntaxError: Unexpected token 'export' on '@react-navigation'

I created a new React Native project and used Jest testing, it goes very well. But when I try it in an existing app it couldn't work, instead it gave me the following error.I suspect it is a ...
xuan 0924's user avatar
0 votes
0 answers
295 views

Testing: react-native (expo) take snapshot of a Screen component inside of react-navigation

My test attempt currently looks like this: import React from "react" import { NavigationContainer } from "@react-navigation/native" import { createStackNavigator } from "@...
Norfeldt's user avatar
  • 9,738
0 votes
1 answer
1k views

@react-navigation/native useNavigation() jest

When I use jest to test my app, I find that if I use useNavigation in my hooks, an error will be reported, and the error message is as follows. I try to use mock myself, but it may be that I can't use ...
user14534315's user avatar

15 30 50 per page
1
2 3 4 5