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