Skip to content

Commit 31320c6

Browse files
committed
Fix docs around search tab and others
1 parent bbf8faa commit 31320c6

8 files changed

Lines changed: 66 additions & 39 deletions

File tree

‎versioned_docs/version-7.x/elements.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -355,15 +355,18 @@ It can contain the following properties:
355355
- `setText` - sets the search bar's content to given value
356356
- `clearText` - removes any text present in the search bar input field
357357
- `cancelSearch` - cancel the search and close the search bar
358-
- `autoCapitalize`: The auto-capitalization behavior. Possible values: `none`, `words`, `sentences`, `characters`.
358+
- `autoCapitalize`: The auto-capitalization behavior. Possible values: `systemDefault`, `none`, `words`, `sentences`, `characters`.
359359
- `autoFocus`: Automatically focus search input on mount.
360360
- `cancelButtonText`: Text to be used instead of default `Cancel` button text (iOS only).
361361
- `cancelButtonAccessibilityLabel`: Accessibility label for the button that closes the search bar. Defaults to `cancelButtonText` on iOS and `Close` on other platforms.
362362
- `clearButtonAccessibilityLabel`: Accessibility label for the button that clears the search input. Defaults to `Clear text`.
363363
- `openButtonAccessibilityLabel`: Accessibility label for the header button that opens the search bar. Defaults to `Search`.
364364
- `inputType`: Type of the input. Possible values: `text`, `phone`, `number`, `email`.
365+
- `enterKeyHint`: Determines how the return key should look. Defaults to `search`.
365366
- `onBlur`: Callback that gets called when search input has lost focus.
366-
- `onChangeText`: Callback that gets called when the text changes.
367+
- `onChangeText`: Callback that gets called when the text changes. It receives an event containing the current text.
368+
- `onSubmitEditing`: Callback that gets called when the submit button is pressed. It receives an event containing the current text.
369+
- `onOpen`: Callback that gets called when search input is opened.
367370
- `onClose`: Callback that gets called when search input is closed.
368371
- `onFocus`: Callback that gets called when search input has received focus.
369372
- `placeholder`: Text displayed when search input is empty.
@@ -373,7 +376,9 @@ React.useLayoutEffect(() => {
373376
navigation.setOptions({
374377
headerSearchBarOptions: {
375378
placeholder: 'Search',
376-
onChangeText: (text) => {
379+
onChangeText: (event) => {
380+
const text = event.nativeEvent.text;
381+
377382
// Do something
378383
},
379384
},

‎versioned_docs/version-7.x/native-bottom-tab-navigator.md‎

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This navigator's API may change in a minor release. It currently only supports i
1616
<source src="/assets/navigators/bottom-tabs/highlights/search-tab.mp4" />
1717
</video>
1818

19-
[Search tab on iOS 26+](#search-tab-on-ios-26)
19+
[Search tab](#search-tab-on-ios)
2020

2121
- <video playsInline autoPlay muted loop>
2222
<source src="/assets/navigators/bottom-tabs/highlights/bottom-accessory.mp4" />
@@ -128,7 +128,7 @@ Uses iOS built-in tab bar items with standard iOS styling and localized titles.
128128

129129
The [`tabBarIcon`](#tabbaricon) and [`tabBarLabel`](#tabbarlabel) options override the icon and label from the system item. If you want to keep the system behavior on iOS, but need to provide icon and label for other platforms, use `Platform.OS` or `Platform.select` to conditionally set `undefined` for `tabBarIcon` and `tabBarLabel` on iOS.
130130

131-
When set to `search`, the tab may receive prominent visual treatment on iOS 26. See [`tabBarRole`](#tabbarrole) for the behavior on iOS 27 and above.
131+
When set to `search`, the tab may receive prominent visual treatment on iOS 26 only. See [`tabBarRole`](#tabbarrole) instead for a setup that works on iOS 27 and above as well.
132132

133133
#### `tabBarRole`
134134

@@ -137,19 +137,19 @@ The role of the tab within the system tab bar. Supported values:
137137
- `prominent` - the tab gets prominent visual treatment when supported on iOS 27 and above
138138
- `search` - the tab is used as the system search tab
139139

140-
With the `prominent` role, the tab may receive special styling to make it stand out, such as a separate button next to the tab bar. Only one tab can have the `prominent` role at a time.
140+
With the `prominent` role, the tab may receive special styling to make it stand out, such as a separate button next to the tab bar. Tabs with prominent styling also stay visible when the tab bar [minimizes](#tabbarminimizebehavior). Only one tab can have the `prominent` role at a time.
141141

142142
<video playsInline autoPlay muted loop>
143143
<source src="/assets/navigators/bottom-tabs/highlights/prominent-tab.mp4" />
144144
</video>
145145

146-
On iOS 26.1, a tab with the `search` role gets prominent visual treatment. On iOS 27 and above, it gets prominent styling only if [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) is enabled and no other tab has the `prominent` role. On iOS 27 and above, it also stays visible when the tab bar [minimizes](#tabbarminimizebehavior).
146+
On iOS 26, a tab with the `search` role gets prominent visual treatment. On iOS 27 and above, it gets prominent styling only if [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) is enabled and no other tab has the `prominent` role.
147147

148148
The tab uses the system search icon and label by default on iOS. You can override them with [`tabBarSystemItem`](#tabbarsystemitem), [`tabBarIcon`](#tabbaricon), or [`tabBarLabel`](#tabbarlabel).
149149

150150
On iOS 26.1 and above, at most one tab can have the `search` role. Adding or removing the `search` role after the tab is rendered is not supported.
151151

152-
Also see [Search tab on iOS 26+](#search-tab-on-ios-26).
152+
Also see [Search tab on iOS](#search-tab-on-ios).
153153

154154
Only supported on iOS.
155155

@@ -163,21 +163,17 @@ Defaults to `false`.
163163

164164
Only supported on iOS 26.1 and above.
165165

166-
##### Search tab on iOS 26+
166+
##### Search tab on iOS
167167

168-
The [`tabBarRole`](#tabbarrole) option has special styling and behavior when set to `search` on iOS 26.1 and above.
168+
When [`tabBarRole`](#tabbarrole) is set to `search`. The icon and label use the system search icon and label by default, and the tab may receive prominent visual treatment on iOS 26 and above.
169169

170-
Additionally, when the `search` tab is selected, the tab bar transforms into a search field if:
170+
On iOS 27 and above, the [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) option also needs to be enabled for the tab to receive prominent visual treatment.
171171

172-
- [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) is enabled
173-
- The screen has a nested [native stack navigator](native-stack-navigator.md)
174-
- The focused screen in the nested native stack has [`headerSearchBarOptions`](native-stack-navigator.md#headersearchbaroptions)
175-
176-
This won't work if `headerSearchBarOptions` is set on the tab screen itself.
172+
Additionally, the bottom tab bar transforms into a search field if it has a nested [native stack navigator](native-stack-navigator.md) with [`headerSearchBarOptions`](native-stack-navigator.md#headersearchbaroptions) on the stack's first screen.
177173

178174
Example:
179175

180-
```js name="Search Tab on iOS 26" snack static2dynamic
176+
```js name="Search Tab on iOS" snack static2dynamic
181177
import * as React from 'react';
182178
import { Platform, View, Text, FlatList } from 'react-native';
183179
import {

‎versioned_docs/version-7.x/native-stack-navigator.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,9 +1226,21 @@ Only supported on Android.
12261226

12271227
A callback that gets called when search bar has lost focus.
12281228

1229+
##### `onFocus`
1230+
1231+
A callback that gets called when search bar has received focus.
1232+
1233+
##### `onOpen`
1234+
1235+
A callback that gets called when search bar is opened. Only supported on Android.
1236+
1237+
##### `onClose`
1238+
1239+
A callback that gets called when search bar is closed. Only supported on Android.
1240+
12291241
##### `onCancelButtonPress`
12301242

1231-
A callback that gets called when the cancel button is pressed.
1243+
A callback that gets called when the cancel button is pressed. Only supported on iOS.
12321244

12331245
##### `onSearchButtonPress`
12341246

@@ -1248,7 +1260,7 @@ React.useLayoutEffect(() => {
12481260
12491261
##### `onChangeText`
12501262
1251-
A callback that gets called when the text changes. It receives the current text value of the search bar.
1263+
A callback that gets called when the text changes. It receives an event containing the current text value of the search bar.
12521264
12531265
Example:
12541266

‎versioned_docs/version-7.x/upgrading-from-6.x.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,9 @@ React.useLayoutEffect(() => {
939939
navigation.setOptions({
940940
headerSearchBarOptions: {
941941
placeholder: 'Search',
942-
onChangeText: (text) => {
942+
onChangeText: (event) => {
943+
const text = event.nativeEvent.text;
944+
943945
// Do something
944946
},
945947
},

‎versioned_docs/version-8.x/bottom-tab-navigator.md‎

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ sidebar_label: Bottom Tabs
1010
<source src="/assets/navigators/bottom-tabs/highlights/search-tab.mp4" />
1111
</video>
1212

13-
[Search tab on iOS 26+](#search-tab-on-ios-26)
13+
[Search tab](#search-tab-on-ios)
1414

1515
- <video playsInline autoPlay muted loop>
1616
<source src="/assets/navigators/bottom-tabs/highlights/bottom-accessory.mp4" />
@@ -424,7 +424,7 @@ Only supported on iOS with `native` implementation.
424424
425425
The [`tabBarIcon`](#tabbaricon) and [`tabBarLabel`](#tabbarlabel) options override the icon and label from the system item. If you want to keep the system behavior on iOS, but need to provide icon and label for other platforms, use `Platform.OS` or `Platform.select` to conditionally set `undefined` for `tabBarIcon` and `tabBarLabel` on iOS.
426426
427-
When set to `search`, the tab may receive prominent visual treatment on iOS 26. See [`tabBarRole`](#tabbarrole) for the behavior on iOS 27 and above.
427+
When set to `search`, the tab may receive prominent visual treatment on iOS 26 only. See [`tabBarRole`](#tabbarrole) instead for a setup that works on iOS 27 and above as well.
428428
429429
#### `tabBarRole`
430430
@@ -433,19 +433,19 @@ The role of the tab within the system tab bar. Supported values:
433433
- `prominent` - the tab gets prominent visual treatment when supported on iOS 27 and above
434434
- `search` - the tab is used as the system search tab
435435
436-
With the `prominent` role, the tab may receive special styling to make it stand out, such as a separate button next to the tab bar. Only one tab can have the `prominent` role at a time.
436+
With the `prominent` role, the tab may receive special styling to make it stand out, such as a separate button next to the tab bar. Tabs with prominent styling also stay visible when the tab bar [minimizes](#tabbarminimizebehavior). Only one tab can have the `prominent` role at a time.
437437
438438
<video playsInline autoPlay muted loop>
439439
<source src="/assets/navigators/bottom-tabs/highlights/prominent-tab.mp4" />
440440
</video>
441441
442-
On iOS 26.1, a tab with the `search` role gets prominent visual treatment. On iOS 27 and above, it gets prominent styling only if [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) is enabled and no other tab has the `prominent` role. On iOS 27 and above, it also stays visible when the tab bar [minimizes](#tabbarminimizebehavior).
442+
On iOS 26, a tab with the `search` role gets prominent visual treatment. On iOS 27 and above, it gets prominent styling only if [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) is enabled and no other tab has the `prominent` role.
443443
444444
The tab uses the system search icon and label by default on iOS. You can override them with [`tabBarSystemItem`](#tabbarsystemitem), [`tabBarIcon`](#tabbaricon), or [`tabBarLabel`](#tabbarlabel).
445445
446446
On iOS 26.1 and above, at most one tab can have the `search` role. Adding or removing the `search` role after the tab is rendered is not supported.
447447
448-
Also see [Search tab on iOS 26+](#search-tab-on-ios-26).
448+
Also see [Search tab on iOS](#search-tab-on-ios).
449449
450450
Only supported on iOS with `native` implementation.
451451
@@ -459,21 +459,17 @@ Defaults to `false`.
459459
460460
Only supported with `native` implementation on iOS 26.1 and above.
461461
462-
##### Search tab on iOS 26+
462+
##### Search tab on iOS
463463
464-
The [`tabBarRole`](#tabbarrole) option has special styling and behavior when set to `search` on iOS 26.1 and above.
464+
When [`tabBarRole`](#tabbarrole) is set to `search`. The icon and label use the system search icon and label by default, and the tab may receive prominent visual treatment on iOS 26 and above.
465465
466-
Additionally, when the `search` tab is selected, the tab bar transforms into a search field if:
466+
On iOS 27 and above, the [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) option also needs to be enabled for the tab to receive prominent visual treatment.
467467
468-
- [`tabBarSearchAutoFocus`](#tabbarsearchautofocus) is enabled
469-
- The screen has a nested [native stack navigator](native-stack-navigator.md)
470-
- The focused screen in the nested native stack has [`headerSearchBarOptions`](native-stack-navigator.md#headersearchbaroptions)
471-
472-
This won't work if `headerSearchBarOptions` is set on the tab screen itself.
468+
Additionally, the bottom tab bar transforms into a search field if it has a nested [native stack navigator](native-stack-navigator.md) with [`headerSearchBarOptions`](native-stack-navigator.md#headersearchbaroptions) on the stack's first screen.
473469
474470
Example:
475471
476-
```js name="Search Tab on iOS 26" snack static2dynamic
472+
```js name="Search Tab on iOS" snack static2dynamic
477473
import * as React from 'react';
478474
import { Platform, View, Text, FlatList } from 'react-native';
479475
import {
@@ -529,6 +525,7 @@ function FruitsListScreen() {
529525

530526
return (
531527
<FlatList
528+
contentInsetAdjustmentBehavior="automatic"
532529
data={filteredData}
533530
keyExtractor={(item) => item}
534531
renderItem={({ item }) => (

‎versioned_docs/version-8.x/elements.md‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,15 +300,18 @@ It can contain the following properties:
300300
- `setText` - sets the search bar's content to given value
301301
- `clearText` - removes any text present in the search bar input field
302302
- `cancelSearch` - cancel the search and close the search bar
303-
- `autoCapitalize`: The auto-capitalization behavior. Possible values: `none`, `words`, `sentences`, `characters`.
303+
- `autoCapitalize`: The auto-capitalization behavior. Possible values: `systemDefault`, `none`, `words`, `sentences`, `characters`.
304304
- `autoFocus`: Automatically focus search input on mount.
305305
- `cancelButtonText`: Text to be used instead of default `Cancel` button text (iOS only).
306306
- `cancelButtonAccessibilityLabel`: Accessibility label for the button that closes the search bar. Defaults to `Close` on iOS 26+, `cancelButtonText` on other iOS versions, and `Back` on other platforms.
307307
- `clearButtonAccessibilityLabel`: Accessibility label for the button that clears the search input. Defaults to `Clear text`.
308308
- `openButtonAccessibilityLabel`: Accessibility label for the header button that opens the search bar. Defaults to `Search`.
309309
- `inputType`: Type of the input. Possible values: `text`, `phone`, `number`, `email`.
310+
- `enterKeyHint`: Determines how the return key should look. Defaults to `search`.
310311
- `onBlur`: Callback that gets called when search input has lost focus.
311-
- `onChange`: Callback that gets called when the text changes.
312+
- `onChange`: Callback that gets called when the text changes. It receives an event containing the current text.
313+
- `onSubmitEditing`: Callback that gets called when the submit button is pressed. It receives an event containing the current text.
314+
- `onOpen`: Callback that gets called when search input is opened.
312315
- `onClose`: Callback that gets called when search input is closed.
313316
- `onFocus`: Callback that gets called when search input has received focus.
314317
- `placeholder`: Text displayed when search input is empty.

‎versioned_docs/version-8.x/native-stack-navigator.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,9 +1235,21 @@ Only supported on Android.
12351235

12361236
A callback that gets called when search bar has lost focus.
12371237

1238+
##### `onFocus`
1239+
1240+
A callback that gets called when search bar has received focus.
1241+
1242+
##### `onOpen`
1243+
1244+
A callback that gets called when search bar is opened. Only supported on Android.
1245+
1246+
##### `onClose`
1247+
1248+
A callback that gets called when search bar is closed. Only supported on Android.
1249+
12381250
##### `onCancelButtonPress`
12391251

1240-
A callback that gets called when the cancel button is pressed.
1252+
A callback that gets called when the cancel button is pressed. Only supported on iOS.
12411253

12421254
##### `onSearchButtonPress`
12431255

@@ -1257,7 +1269,7 @@ React.useLayoutEffect(() => {
12571269
12581270
##### `onChange`
12591271
1260-
A callback that gets called when the text changes. It receives en event containing the current text value of the search bar.
1272+
A callback that gets called when the text changes. It receives an event containing the current text value of the search bar.
12611273
12621274
Example:
12631275

‎versioned_docs/version-8.x/upgrading-from-7.x.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ See the [Bottom Tab Navigator docs](bottom-tab-navigator.md) for all the availab
302302

303303
#### Bottom Tabs no longer shows header by default
304304

305-
Since Bottom Tabs now renders native tabs by default, the header is no longer shown by default to match native look and feel. You can nest a [Native Stack Navigator](native-stack-navigator.md) inside each tab to show a header that integrates well with native tabs, e.g. [search tab on iOS 26+](bottom-tab-navigator.md#search-tab-on-ios-26).
305+
Since Bottom Tabs now renders native tabs by default, the header is no longer shown by default to match native look and feel. You can nest a [Native Stack Navigator](native-stack-navigator.md) inside each tab to show a header that integrates well with native tabs, e.g. [search tab on iOS](bottom-tab-navigator.md#search-tab-on-ios).
306306

307307
Alternatively, you can enable the built-in header by passing `headerShown: true` in `screenOptions` of the navigator:
308308

0 commit comments

Comments
 (0)