Skip to content

Commit bff96b7

Browse files
authored
Update native-stack-navigator.md
Add onSearchButtonPress prop to headerSearchBarOptions
1 parent 6e1734c commit bff96b7

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

versioned_docs/version-6.x/native-stack-navigator.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,22 @@ React.useLayoutEffect(() => {
384384
}, [navigation]);
385385
```
386386

387+
### `onSearchButtonPress`
388+
389+
A callback that gets called when the search button is pressed.
390+
391+
```js
392+
const [search, setSearch] = React.useState('');
393+
394+
React.useLayoutEffect(() => {
395+
navigation.setOptions({
396+
headerSearchBarOptions: {
397+
onSearchButtonPress: (event) => setSearch(event?.nativeEvent?.text),
398+
},
399+
});
400+
}, [navigation]);
401+
```
402+
387403
#### `header`
388404
389405
Custom header to use instead of the default header.

0 commit comments

Comments
 (0)