You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/native-stack-navigator.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -479,9 +479,9 @@ Example:
479
479
480
480
#### `headerSearchBarOptions`
481
481
482
-
Options to render a native search bar on iOS. Search bars are rarely static so normally it is controlled by passing an object to `headerSearchBarOptions` navigation option in the component's body. You also need to specify `contentInsetAdjustmentBehavior="automatic"` in your `ScrollView`, `FlatList` etc. If you don't have a `ScrollView`, specify `headerTransparent: false`.
482
+
Options to render a native search bar on iOS. Search bars are rarely static so normally it is controlled by passing an object to `headerSearchBarOptions` navigation option in the component's body.
483
483
484
-
Only supported on iOS and Android.
484
+
You also need to specify `contentInsetAdjustmentBehavior="automatic"` in your `ScrollView`, `FlatList` etc. If you don't have a `ScrollView`, specify `headerTransparent: false`.
Copy file name to clipboardExpand all lines: versioned_docs/version-7.x/upgrading-from-6.x.md
+19
Original file line number
Diff line number
Diff line change
@@ -796,6 +796,25 @@ return (
796
796
);
797
797
```
798
798
799
+
#### All navigators with headers now support `headerSearchBarOptions`
800
+
801
+
The `Header` component from `@react-navigation/elements` now supports a `headerSearchBarOptions` prop. This means all navigators that use the `Header` component now support a search bar in the header as well on all platforms. Previously, this was only available in the Native Stack Navigator on iOS and Android.
802
+
803
+
```js
804
+
React.useLayoutEffect(() => {
805
+
navigation.setOptions({
806
+
headerSearchBarOptions: {
807
+
placeholder:'Search',
808
+
onChangeText: (text) => {
809
+
// Do something
810
+
},
811
+
},
812
+
});
813
+
}, [navigation]);
814
+
```
815
+
816
+
See [`headerSearchBarOptions`](elements.md#headersearchbaroptions) for usage.
817
+
799
818
### New components in elements library
800
819
801
820
The `@react-navigation/elements` package now includes new components that can be used in your app:
0 commit comments