Skip to content

Commit b24e93b

Browse files
committed
Fix highlight on lifecycle examples
1 parent 697af0e commit b24e93b

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

versioned_docs/version-7.x/navigation-lifecycle.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -308,28 +308,25 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack';
308308
function ProfileScreen() {
309309
const navigation = useNavigation();
310310

311-
// highlight-start
312311
React.useEffect(() => {
312+
// highlight-start
313313
const unsubscribe = navigation.addListener('focus', () => {
314-
// Screen was focused
315-
// Do something
316-
317314
console.log('ProfileScreen focused');
318315
});
316+
// highlight-end
319317

320318
return unsubscribe;
321319
}, [navigation]);
322-
// highlight-end
323320

324-
// highlight-start
325321
React.useEffect(() => {
322+
// highlight-start
326323
const unsubscribe = navigation.addListener('blur', () => {
327324
console.log('ProfileScreen blurred');
328325
});
326+
// highlight-end
329327

330328
return unsubscribe;
331329
}, [navigation]);
332-
// highlight-end
333330

334331
return (
335332
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
@@ -396,28 +393,25 @@ import { createNativeStackNavigator } from '@react-navigation/native-stack';
396393
function ProfileScreen() {
397394
const navigation = useNavigation();
398395

399-
400396
React.useEffect(() => {
397+
// highlight-start
401398
const unsubscribe = navigation.addListener('focus', () => {
402-
// Screen was focused
403-
// Do something
404-
405399
console.log('ProfileScreen focused');
406400
});
401+
// highlight-end
407402

408403
return unsubscribe;
409404
}, [navigation]);
410-
// highlight-end
411405

412-
// highlight-start
413406
React.useEffect(() => {
407+
// highlight-start
414408
const unsubscribe = navigation.addListener('blur', () => {
415409
console.log('ProfileScreen blurred');
416410
});
411+
// highlight-end
417412

418413
return unsubscribe;
419414
}, [navigation]);
420-
// highlight-end
421415

422416
return (
423417
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>

0 commit comments

Comments
 (0)