Skip to content

Commit 9250880

Browse files
committed
fix: badge value of 0 crash
If one of the badge values was `0`, it would cause a crash because it would try to render the `0` outside of a `Text` component. The code also didn't allow for a badge with `0` to be rendered in the first place. This fixes that by checking if the type of the badge value is a `number`, instead of checking if it's _truthy_.
1 parent 3df23f3 commit 9250880

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ const SegmentedControl: React.FC<SegmentedControlProps> = ({
210210
>
211211
{segment}
212212
</Text>
213-
{badgeValues[index] && (
213+
{typeof badgeValues[index] === 'number' && (
214214
<View
215215
style={[
216216
styles.defaultBadgeContainerStyle,

0 commit comments

Comments
 (0)