@@ -313,7 +313,6 @@ Without preloading test example:
313
313
import { expect , test } from ' @jest/globals' ;
314
314
import { createDrawerNavigator } from ' @react-navigation/drawer' ;
315
315
import {
316
- createNavigationContainerRef ,
317
316
createStaticNavigation ,
318
317
useNavigation ,
319
318
} from ' @react-navigation/native' ;
@@ -354,8 +353,7 @@ const Drawer = createDrawerNavigator({
354
353
const DrawerNavigation = createStaticNavigation (Drawer);
355
354
356
355
test (' navigates to settings without previous preload' , () => {
357
- const navigation = createNavigationContainerRef ();
358
- render (< DrawerNavigation ref= {navigation} / > );
356
+ render (< DrawerNavigation / > );
359
357
360
358
expect (screen .queryByText (' Profile Screen' )).toBeOnTheScreen ();
361
359
expect (screen .queryByText (' Settings Screen' )).not .toBeOnTheScreen ();
@@ -375,10 +373,7 @@ test('navigates to settings without previous preload', () => {
375
373
``` js
376
374
import { expect , test } from ' @jest/globals' ;
377
375
import { createDrawerNavigator } from ' @react-navigation/drawer' ;
378
- import {
379
- createNavigationContainerRef ,
380
- NavigationContainer ,
381
- } from ' @react-navigation/native' ;
376
+ import { NavigationContainer } from ' @react-navigation/native' ;
382
377
import { fireEvent , render , screen } from ' @testing-library/react-native' ;
383
378
import { Button , Text , View } from ' react-native' ;
384
379
@@ -417,9 +412,8 @@ const DrawerNavigation = () => {
417
412
};
418
413
419
414
test (' navigates to settings without previous preload' , () => {
420
- const navigation = createNavigationContainerRef ();
421
415
render (
422
- < NavigationContainer ref = {navigation} >
416
+ < NavigationContainer>
423
417
< DrawerNavigation / >
424
418
< / NavigationContainer>
425
419
);
0 commit comments