File tree 1 file changed +24
-0
lines changed
versioned_docs/version-7.x 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -502,3 +502,27 @@ The `navigation` object has a `setOptions` method that lets you update the optio
502
502
Update options
503
503
< / Button>
504
504
```
505
+
506
+ Futhermore, ` navigation.setOptions() ` can be used to set Custom header components for ` headerLeft ` , ` headerTitle ` and ` headerRight `
507
+
508
+ ``` js name="setOptions for navigation" snack dependencies=@expo/vector-icons
509
+ import React , { useEffect } from ' react' ;
510
+
511
+ const MyScreen = ({ navigation, route, ... props }) => {
512
+ useEffect (() => {
513
+ // Setting custom header components
514
+ navigation .setOptions ({
515
+ headerLeft: < CustomHeaderLeftComponent {... props} / > , // Custom component on the left
516
+ headerTitle: < CustomHeaderTitleComponent {... props} / > , // Custom title component
517
+ headerRight: < CustomHeaderRightComponent {... props} / > , // Custom component on the right
518
+ });
519
+ }, [navigation, props]); // Adding 'props' as a dependency if required
520
+
521
+ return (
522
+ // Your screen content
523
+ < View>
524
+ < Text > My Screen Content< / Text >
525
+ < / View>
526
+ );
527
+ };
528
+ ```
You can’t perform that action at this time.
0 commit comments