@@ -313,7 +313,6 @@ Without preloading test example:
313313import { expect , test } from ' @jest/globals' ;
314314import { createDrawerNavigator } from ' @react-navigation/drawer' ;
315315import {
316- createNavigationContainerRef ,
317316 createStaticNavigation ,
318317 useNavigation ,
319318} from ' @react-navigation/native' ;
@@ -354,8 +353,7 @@ const Drawer = createDrawerNavigator({
354353const DrawerNavigation = createStaticNavigation (Drawer);
355354
356355test (' navigates to settings without previous preload' , () => {
357- const navigation = createNavigationContainerRef ();
358- render (< DrawerNavigation ref= {navigation} / > );
356+ render (< DrawerNavigation / > );
359357
360358 expect (screen .queryByText (' Profile Screen' )).toBeOnTheScreen ();
361359 expect (screen .queryByText (' Settings Screen' )).not .toBeOnTheScreen ();
@@ -375,10 +373,7 @@ test('navigates to settings without previous preload', () => {
375373``` js
376374import { expect , test } from ' @jest/globals' ;
377375import { createDrawerNavigator } from ' @react-navigation/drawer' ;
378- import {
379- createNavigationContainerRef ,
380- NavigationContainer ,
381- } from ' @react-navigation/native' ;
376+ import { NavigationContainer } from ' @react-navigation/native' ;
382377import { fireEvent , render , screen } from ' @testing-library/react-native' ;
383378import { Button , Text , View } from ' react-native' ;
384379
@@ -417,9 +412,8 @@ const DrawerNavigation = () => {
417412};
418413
419414test (' navigates to settings without previous preload' , () => {
420- const navigation = createNavigationContainerRef ();
421415 render (
422- < NavigationContainer ref = {navigation} >
416+ < NavigationContainer>
423417 < DrawerNavigation / >
424418 < / NavigationContainer>
425419 );
0 commit comments