Skip to content

Commit 7f4d4b5

Browse files
committed
fix: Update skeleton prop logic in Txt component and adjust usage in NewCoordinateNotes screen
1 parent aa533fd commit 7f4d4b5

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/components/Text.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ type TxtProps = TextProps & {
1515
skeleton?: boolean | string | number | object | undefined | null
1616
}
1717

18-
export function Txt({ children, size, style, skeleton = true, ...rest }: TxtProps) {
19-
if (skeleton === undefined) return <TxtSkeleton />
18+
export function Txt({ children, size, style, skeleton, ...rest }: TxtProps) {
19+
if (skeleton) return <TxtSkeleton />
2020
return (
2121
<Medium className='text-zinc-500' style={[{ fontSize: size || 11.5 }, style]} {...rest}>
2222
{children}

src/screens/CoordinateNotes/NewCoordinateNotes.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,43 +87,46 @@ export default function NewCoordinateNotes({ navigation }: NavProp) {
8787
function LocationDetails({ data }: { data: GeoPosition | undefined }) {
8888
console.log(data?.coords.latitude)
8989
const { coords: { latitude, longitude, accuracy, altitude, altitudeAccuracy, speed } = {}, timestamp } = data || {}
90+
91+
console.log(latitude, longitude, accuracy, altitude, altitudeAccuracy, speed, timestamp)
92+
9093
return (
9194
<>
9295
<Gap12>
9396
<SettGroup title='Location Details'>
9497
<SettOption
9598
title='Latitude'
9699
Icon={<RoundedIcon Icon={LongitudeIcon} className='bg-blue-500' />}
97-
Right={<Txt skeleton={latitude}>{getLatitude(latitude || 0)}</Txt>}
100+
Right={<Txt skeleton={latitude === undefined}>{getLatitude(latitude || 0)}</Txt>}
98101
/>
99102
<SettOption
100103
title='Longitude'
101104
Icon={<RoundedIcon Icon={LatitudeIcon} className='bg-green-500' />}
102-
Right={<Txt skeleton={longitude}>{getLongitude(longitude || 0)}</Txt>}
105+
Right={<Txt skeleton={longitude === undefined}>{getLongitude(longitude || 0)}</Txt>}
103106
/>
104107
<SettOption
105108
title='Accuracy'
106109
Icon={<RoundedIcon Icon={DashboardSpeed02Icon} className='bg-rose-500' />}
107-
Right={<Txt skeleton={accuracy}>{accuracy?.toFixed(0)} m</Txt>}
110+
Right={<Txt skeleton={accuracy === undefined}>{accuracy?.toFixed(0)} m</Txt>}
108111
/>
109112
<SettOption
110113
title='Altitude'
111114
Icon={<RoundedIcon Icon={EarthIcon} className='bg-blue-500' />}
112115
Right={
113-
<Txt skeleton={altitude}>
116+
<Txt skeleton={altitude === undefined}>
114117
{altitude?.toFixed(0)} m ± {altitudeAccuracy?.toFixed(0)} m
115118
</Txt>
116119
}
117120
/>
118121
<SettOption
119122
title='Speed'
120123
Icon={<RoundedIcon Icon={Rocket01Icon} className='bg-orange-500' />}
121-
Right={<Txt skeleton={speed}>{speed?.toFixed(0)} m/s</Txt>}
124+
Right={<Txt skeleton={speed === undefined}>{speed?.toFixed(0)} m/s</Txt>}
122125
/>
123126
<SettOption
124127
title='Timestamp'
125128
Icon={<RoundedIcon Icon={Timer02Icon} className='bg-accent' />}
126-
Right={<Txt skeleton={timestamp}>{new Date(timestamp || 0).toLocaleString()}</Txt>}
129+
Right={<Txt skeleton={timestamp === undefined}>{new Date(timestamp || 0).toLocaleString()}</Txt>}
127130
/>
128131
</SettGroup>
129132
</Gap12>

0 commit comments

Comments
 (0)