Skip to content

Commit 582df08

Browse files
committed
Add documentation for tab bar badge
1 parent 9b75d83 commit 582df08

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

versioned_docs/version-5.x/bottom-tab-navigator.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,10 @@ Function that given `{ focused: boolean, color: string, size: number }` returns
237237

238238
Title string of a tab displayed in the tab bar or a function that given `{ focused: boolean, color: string }` returns a React.Node, to display in tab bar. When undefined, scene `title` is used. To hide, see `tabBarOptions.showLabel` in the previous section.
239239

240+
#### `tabBarBadge`
241+
242+
Text to show in a badge on the tab icon. Accepts a `string` or a `number`.
243+
240244
#### `tabBarButton`
241245

242246
Function which returns a React element to render as the tab bar button. It wraps the icon and label and implements `onPress`. Renders `TouchableWithoutFeedback` by default. `tabBarButton: props => <TouchableOpacity {...props} />` would use `TouchableOpacity` instead.
@@ -272,7 +276,7 @@ To prevent the default behavior, you can call `event.preventDefault`:
272276

273277
```js
274278
React.useEffect(() => {
275-
const unsubscribe = navigation.addListener('tabPress', e => {
279+
const unsubscribe = navigation.addListener('tabPress', (e) => {
276280
// Prevent default behavior
277281
e.preventDefault();
278282

@@ -294,7 +298,7 @@ Example:
294298

295299
```js
296300
React.useEffect(() => {
297-
const unsubscribe = navigation.addListener('tabLongPress', e => {
301+
const unsubscribe = navigation.addListener('tabLongPress', (e) => {
298302
// Do something
299303
});
300304

@@ -355,6 +359,7 @@ function MyTabs() {
355359
tabBarIcon: ({ color, size }) => (
356360
<MaterialCommunityIcons name="bell" color={color} size={size} />
357361
),
362+
tabBarBadge: 3,
358363
}}
359364
/>
360365
<Tab.Screen

0 commit comments

Comments
 (0)