Repository navigation
Expand file tree
/
Copy pathlocation-map.native.tsx
More file actions
74 lines (70 loc) · 1.89 KB
/
Copy pathlocation-map.native.tsx
File metadata and controls
74 lines (70 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import * as React from 'react'
import * as Kb from '@/common-adapters'
import openURL from '@/util/open-url'
type Props = {
height: number
mapSrc: string
onLoad?: () => void
width: number
}
const LocationMap = (props: Props) => {
const {height, mapSrc, width} = props
const [mapLoaded, setMapLoaded] = React.useState(false)
const onLoad = () => {
setMapLoaded(true)
!!props.onLoad && props.onLoad()
}
return (
<Kb.Box2 direction="vertical" fullHeight={true} fullWidth={true} gap="small" style={styles.container}>
{!!mapSrc && <Kb.Image2 src={mapSrc} style={{height, width}} onLoad={onLoad} />}
{!mapLoaded && <Kb.ProgressIndicator style={styles.loading} />}
<Kb.Banner color="white" style={styles.banner}>
<Kb.BannerParagraph
bannerColor="white"
content={[
'Your location is protected. ',
{onClick: () => openURL('https://book.keybase.io/docs/chat/location'), text: 'Learn more'},
]}
/>
</Kb.Banner>
</Kb.Box2>
)
}
export default LocationMap
const styles = Kb.Styles.styleSheetCreate(
() =>
({
banner: {
backgroundColor: Kb.Styles.globalColors.white,
borderBottomWidth: 1,
borderColor: Kb.Styles.globalColors.black_10,
left: 0,
position: 'absolute',
top: 0,
},
container: {
...Kb.Styles.globalStyles.fillAbsolute,
justifyContent: 'center',
},
learn: {
color: Kb.Styles.globalColors.blueDark,
},
loading: {
bottom: '50%',
left: '50%',
marginBottom: -12,
marginLeft: -12,
marginRight: -12,
marginTop: -12,
position: 'absolute',
right: '50%',
top: '50%',
width: 24,
},
mapImage: Kb.Styles.platformStyles({
isTablet: {
resizeMode: 'cover',
},
}),
}) as const
)