From 9a1f1597faa6774341924696c455ca3547db0671 Mon Sep 17 00:00:00 2001
From: Gajanan Bodhankar <124874678+GajananBodhankar@users.noreply.github.com>
Date: Fri, 21 Feb 2025 23:09:35 +0530
Subject: [PATCH] Update screen-options.md by detailing about
navigation.setOptions()
---
versioned_docs/version-7.x/screen-options.md | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/versioned_docs/version-7.x/screen-options.md b/versioned_docs/version-7.x/screen-options.md
index 1f95d0f348..f3da9ea860 100644
--- a/versioned_docs/version-7.x/screen-options.md
+++ b/versioned_docs/version-7.x/screen-options.md
@@ -502,3 +502,27 @@ The `navigation` object has a `setOptions` method that lets you update the optio
Update options
```
+
+Futhermore, `navigation.setOptions()` can be used to set Custom header components for `headerLeft`, `headerTitle` and `headerRight`
+
+```js name="setOptions for navigation" snack dependencies=@expo/vector-icons
+import React, { useEffect } from 'react';
+
+const MyScreen = ({ navigation, route, ...props }) => {
+ useEffect(() => {
+ // Setting custom header components
+ navigation.setOptions({
+ headerLeft: , // Custom component on the left
+ headerTitle: , // Custom title component
+ headerRight: , // Custom component on the right
+ });
+ }, [navigation, props]); // Adding 'props' as a dependency if required
+
+ return (
+ // Your screen content
+
+ My Screen Content
+
+ );
+};
+```