From 850a93d333ff0c22c72dea7fa947a19af9e43163 Mon Sep 17 00:00:00 2001 From: Gajanan Bodhankar <124874678+GajananBodhankar@users.noreply.github.com> Date: Fri, 21 Feb 2025 23:19:42 +0530 Subject: [PATCH] Update screen-options.md by detailing the navigation.setOptions() --- versioned_docs/version-7.x/screen-options.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/versioned_docs/version-7.x/screen-options.md b/versioned_docs/version-7.x/screen-options.md index 1f95d0f348..ad47eb6419 100644 --- a/versioned_docs/version-7.x/screen-options.md +++ b/versioned_docs/version-7.x/screen-options.md @@ -502,3 +502,16 @@ 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" + 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 +```