Skip to content

Badge errors with Text strings must be rendered within a <Text> component #4492

Closed
@amarjanica

Description

@amarjanica

Current behaviour

Badge in Drawer.CollapsedItem throws Text strings must be rendered within a <Text> component but only when I input a zero.
For all other numbers it works.

How to reproduce?

<Drawer.CollapsedItem
          onPress={() => {}}
          focusedIcon="account-group"
          badge={0}
          unfocusedIcon="account-group-outline"
          label="Group"
        />

I ran this in expo dev client on a real device if it matters.

What have you tried so far?

I know how to handle this, just not set badge if count is zero. But maybe you want to handle it in code.

Your Environment

software version
ios x
android x
react-native x.x.x
react-native-paper 5.12.5
node x.x.x
npm or yarn x.x.x
expo sdk 51.0.31

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions