@@ -4,19 +4,21 @@ import {
4
4
LatitudeIcon ,
5
5
LongitudeIcon ,
6
6
MapsLocation02SolidIcon ,
7
- Rocket01Icon ,
7
+ Sent02Icon ,
8
8
Timer02Icon ,
9
9
} from '@assets/icons/icons'
10
10
import { Gap12 } from '@components/Gap'
11
11
import RoundedIcon from '@components/RoundedIcon'
12
12
import SettGroup from '@components/Settings/SettGroup'
13
13
import { SettOption } from '@components/Settings/SettOption'
14
14
import { Txt } from '@components/Text'
15
- import { getLatitude , getLongitude } from '@utils/utils'
16
- import { Linking } from 'react-native'
15
+ import { getLatitude , getLongitude , layout } from '@utils/utils'
16
+ import { Linking , Share } from 'react-native'
17
17
import { GeoPosition } from 'react-native-geolocation-service'
18
+ import Animated , { FadeIn , FadeOut } from 'react-native-reanimated'
19
+ import { shareMessage } from './lib'
18
20
19
- export default function LocationDetails ( { data } : { data : GeoPosition | undefined } ) {
21
+ export default function LocationDetails ( { data } : { data : GeoPosition | undefined | null } ) {
20
22
const { coords : { latitude, longitude, accuracy, altitude, altitudeAccuracy, speed } = { } , timestamp } = data || { }
21
23
22
24
return (
@@ -47,28 +49,40 @@ export default function LocationDetails({ data }: { data: GeoPosition | undefine
47
49
</ Txt >
48
50
}
49
51
/>
50
- < SettOption
52
+ { /* <SettOption
51
53
title='Speed'
52
54
Icon={<RoundedIcon Icon={Rocket01Icon} className='bg-orange-500' />}
53
55
Right={<Txt skeleton={speed === undefined}>{speed?.toFixed(0)} m/s</Txt>}
54
- />
56
+ /> */ }
55
57
< SettOption
56
58
title = 'Timestamp'
57
59
Icon = { < RoundedIcon Icon = { Timer02Icon } className = 'bg-accent' /> }
58
60
Right = { < Txt skeleton = { timestamp === undefined } > { new Date ( timestamp || 0 ) . toLocaleString ( ) } </ Txt > }
59
61
/>
60
62
</ SettGroup >
61
63
{ latitude && longitude && (
62
- < SettGroup title = 'View on Map' >
63
- < SettOption
64
- title = 'View on Map'
65
- Icon = { < RoundedIcon Icon = { MapsLocation02SolidIcon } className = 'bg-green-500' /> }
66
- onPress = { ( ) =>
67
- Linking . openURL ( `https://www.google.com/maps/search/?api=1&query=${ latitude } ,${ longitude } ` )
68
- }
69
- arrow
70
- />
71
- </ SettGroup >
64
+ < Animated . View layout = { layout } entering = { FadeIn } exiting = { FadeOut } >
65
+ < SettGroup title = 'Actions' >
66
+ < SettOption
67
+ title = 'View on Map'
68
+ Icon = { < RoundedIcon Icon = { MapsLocation02SolidIcon } className = 'bg-green-500' /> }
69
+ onPress = { ( ) =>
70
+ Linking . openURL ( `https://www.google.com/maps/search/?api=1&query=${ latitude } ,${ longitude } ` )
71
+ }
72
+ arrow
73
+ />
74
+ < SettOption
75
+ title = 'Share Location'
76
+ Icon = { < RoundedIcon Icon = { Sent02Icon } className = 'bg-blue-500' /> }
77
+ onPress = { ( ) =>
78
+ Share . share ( {
79
+ message : shareMessage ( latitude || 0 , longitude || 0 , timestamp ) ,
80
+ } )
81
+ }
82
+ arrow
83
+ />
84
+ </ SettGroup >
85
+ </ Animated . View >
72
86
) }
73
87
</ Gap12 >
74
88
</ >
0 commit comments