Skip to content

Commit 9e15acd

Browse files
committed
Refactor MoonPhase component to handle edge case of phase being 0
1 parent 3a65489 commit 9e15acd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/screens/Weather/Main/components/MoonPhase.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,15 @@ type MoonRiseSetProps = {
1818

1919
export default function MoonPhase({ moonrise, moonset, phase, theme }: MoonRiseSetProps) {
2020
const timeFormat = weatherStore((state) => state.weatherTimeFormat)
21+
const phaseNumber = phase === 0 ? 0 : phase || '__'
2122

2223
return (
2324
<View className='rounded-3xl bg-black/10' style={boxFullSize}>
2425
<WeatherLabel Icon={Moon02SolidIcon} color={theme.color} label={'Moon Phase'} />
2526
<View className='flex-1 justify-between px-5 pb-4 pt-0'>
2627
<View className='flex-row justify-between'>
2728
<View className='flex-1'>
28-
<Medium style={[{ fontSize: 35 }, theme.color]}>{phase || '__'}</Medium>
29+
<Medium style={[{ fontSize: 35 }, theme.color]}>{phaseNumber}</Medium>
2930
<Regular style={[theme.color, F.F12]}>{moonPhaseString(phase || 1)}</Regular>
3031
{/* <View> */}
3132
<Regular style={[theme.color, F.F12]}>

0 commit comments

Comments
 (0)