From 9250880a936c044410fe20b5b1f70ec7684ba5f0 Mon Sep 17 00:00:00 2001 From: Gustavo Parreira Date: Tue, 3 May 2022 13:17:42 +0100 Subject: [PATCH] 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_. --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 39abb17a..1c131453 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -210,7 +210,7 @@ const SegmentedControl: React.FC = ({ > {segment} - {badgeValues[index] && ( + {typeof badgeValues[index] === 'number' && (