File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed
versioned_docs/version-7.x Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -308,28 +308,25 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack';
308
308
function ProfileScreen () {
309
309
const navigation = useNavigation ();
310
310
311
- // highlight-start
312
311
React .useEffect (() => {
312
+ // highlight-start
313
313
const unsubscribe = navigation .addListener (' focus' , () => {
314
- // Screen was focused
315
- // Do something
316
-
317
314
console .log (' ProfileScreen focused' );
318
315
});
316
+ // highlight-end
319
317
320
318
return unsubscribe;
321
319
}, [navigation]);
322
- // highlight-end
323
320
324
- // highlight-start
325
321
React .useEffect (() => {
322
+ // highlight-start
326
323
const unsubscribe = navigation .addListener (' blur' , () => {
327
324
console .log (' ProfileScreen blurred' );
328
325
});
326
+ // highlight-end
329
327
330
328
return unsubscribe;
331
329
}, [navigation]);
332
- // highlight-end
333
330
334
331
return (
335
332
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
@@ -396,28 +393,25 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack';
396
393
function ProfileScreen () {
397
394
const navigation = useNavigation ();
398
395
399
-
400
396
React .useEffect (() => {
397
+ // highlight-start
401
398
const unsubscribe = navigation .addListener (' focus' , () => {
402
- // Screen was focused
403
- // Do something
404
-
405
399
console .log (' ProfileScreen focused' );
406
400
});
401
+ // highlight-end
407
402
408
403
return unsubscribe;
409
404
}, [navigation]);
410
- // highlight-end
411
405
412
- // highlight-start
413
406
React .useEffect (() => {
407
+ // highlight-start
414
408
const unsubscribe = navigation .addListener (' blur' , () => {
415
409
console .log (' ProfileScreen blurred' );
416
410
});
411
+ // highlight-end
417
412
418
413
return unsubscribe;
419
414
}, [navigation]);
420
- // highlight-end
421
415
422
416
return (
423
417
< View style= {{ flex: 1 , alignItems: ' center' , justifyContent: ' center' }}>
You can’t perform that action at this time.
0 commit comments