-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
694 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import React from 'react'; | ||
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome'; | ||
import { faBolt } from '@fortawesome/free-solid-svg-icons'; | ||
import { Button, useTheme } from 'tamagui'; | ||
|
||
const HeaderButton = ({ icon, size, onPress, ...props }) => { | ||
const theme = useTheme(); | ||
|
||
const handlePress = function () { | ||
if (typeof onPress === 'function') { | ||
onPress(); | ||
} | ||
}; | ||
|
||
return ( | ||
<Button onPress={handlePress} justifyContent='center' alignItems='center' backgroundColor='$secondary' circular size={size ?? 45} {...props}> | ||
<Button.Icon> | ||
<FontAwesomeIcon icon={icon ? icon : faBolt} color={theme.color.val} /> | ||
</Button.Icon> | ||
</Button> | ||
); | ||
}; | ||
|
||
export default HeaderButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { useState } from 'react'; | ||
import { TouchableOpacity, StyleSheet } from 'react-native'; | ||
import MapView, { Marker } from 'react-native-maps'; | ||
import { YStack, useTheme } from 'tamagui'; | ||
import { restoreFleetbasePlace, getCoordinates } from '../utils/location'; | ||
|
||
const PlaceMapView = ({ place: _place, height = 200, onPress, mapViewProps = {}, ...props }) => { | ||
const place = restoreFleetbasePlace(_place); | ||
const [latitude, longitude] = getCoordinates(place); | ||
const [mapRegion, setMapRegion] = useState({ | ||
latitude, | ||
longitude, | ||
latitudeDelta: 0.0005, | ||
longitudeDelta: 0.0005, | ||
}); | ||
|
||
return ( | ||
<TouchableOpacity onPress={onPress}> | ||
<YStack flex={1} position='relative' overflow='hidden' width='100%' borderRadius='$4' height={height} {...props}> | ||
<MapView | ||
style={{ ...StyleSheet.absoluteFillObject, width: '100%', height: '100%' }} | ||
initialRegion={mapRegion} | ||
onRegionChangeComplete={(region) => setMapRegion(region)} | ||
scrollEnabled={false} | ||
zoomEnabled={false} | ||
pitchEnabled={false} | ||
rotateEnabled={false} | ||
{...mapViewProps} | ||
> | ||
<Marker coordinate={{ latitude, longitude }} /> | ||
</MapView> | ||
</YStack> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
export default PlaceMapView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.