dont render 0

This commit is contained in:
Hailey
2024-09-02 01:11:52 -07:00
parent 92445aeae5
commit eac187c4ca
+5 -4
View File
@@ -52,6 +52,8 @@ export function CountWheel({
const [prevCount, setPrevCount] = React.useState(likeCount)
const prevIsLiked = React.useRef(isLiked)
const formattedCount = formatCount(likeCount)
const formattedPrevCount = formatCount(prevCount)
React.useEffect(() => {
if (isLiked === prevIsLiked.current) {
@@ -73,12 +75,12 @@ export function CountWheel({
prevIsLiked.current = isLiked
}, [isLiked, likeCount, shouldAnimate, shouldRoll])
const formattedCount = formatCount(likeCount)
const formattedPrevCount = formatCount(prevCount)
if (likeCount < 1) {
return null
}
return (
<View>
{likeCount > 0 ? (
<View
aria-disabled={true}
// @ts-expect-error is div
@@ -95,7 +97,6 @@ export function CountWheel({
{formattedCount}
</Text>
</View>
) : null}
<View
style={{position: 'absolute'}}
aria-disabled={true}