Skip to content

Colota - Android GPS Location tracker

style: extract inline positioning styles to shared stylesheet

Max Dietrich911686e833d3
diff --git a/apps/mobile/src/components/features/map/MapActionButton.tsx b/apps/mobile/src/components/features/map/MapActionButton.tsx
index d6a51b1a..8c6d92c2 100644
--- a/apps/mobile/src/components/features/map/MapActionButton.tsx
+++ b/apps/mobile/src/components/features/map/MapActionButton.tsx
@@ -13,6 +13,8 @@ interface Props {
children: React.ReactNode
}
+export { styles as mapActionStyles }
+
export function MapActionButton({ onPress, style, children }: Props) {
const { colors } = useTheme()
@@ -47,5 +49,7 @@ const styles = StyleSheet.create({
shadowRadius: 3.84,
borderWidth: 1,
zIndex: 10
- }
+ },
+ right: { right: 16 },
+ left: { left: 16 }
})
diff --git a/apps/mobile/src/components/features/map/MapCenterButton.tsx b/apps/mobile/src/components/features/map/MapCenterButton.tsx
index b59249bb..11fd4e09 100644
--- a/apps/mobile/src/components/features/map/MapCenterButton.tsx
+++ b/apps/mobile/src/components/features/map/MapCenterButton.tsx
@@ -7,7 +7,7 @@ import React from "react"
import { ViewStyle, StyleProp } from "react-native"
import { LocateFixed } from "lucide-react-native"
import { useTheme } from "../../../hooks/useTheme"
-import { MapActionButton } from "./MapActionButton"
+import { MapActionButton, mapActionStyles } from "./MapActionButton"
interface Props {
onPress: () => void
@@ -21,7 +21,7 @@ export const MapCenterButton: React.FC<Props> = ({ onPress, visible, style }) =>
if (!visible) return null
return (
- <MapActionButton onPress={onPress} style={[{ right: 16 }, style]}>
+ <MapActionButton onPress={onPress} style={[mapActionStyles.right, style]}>
<LocateFixed size={24} color={colors.text} />
</MapActionButton>
)
diff --git a/apps/mobile/src/components/features/map/TrackToggleButton.tsx b/apps/mobile/src/components/features/map/TrackToggleButton.tsx
index a19d847c..a7a1f8f6 100644
--- a/apps/mobile/src/components/features/map/TrackToggleButton.tsx
+++ b/apps/mobile/src/components/features/map/TrackToggleButton.tsx
@@ -6,7 +6,7 @@
import React from "react"
import { Route } from "lucide-react-native"
import { useTheme } from "../../../hooks/useTheme"
-import { MapActionButton } from "./MapActionButton"
+import { MapActionButton, mapActionStyles } from "./MapActionButton"
interface Props {
onPress: () => void
@@ -17,7 +17,7 @@ export function TrackToggleButton({ onPress, active }: Props) {
const { colors } = useTheme()
return (
- <MapActionButton onPress={onPress} style={{ left: 16 }}>
+ <MapActionButton onPress={onPress} style={mapActionStyles.left}>
<Route size={24} color={active ? colors.primary : colors.text} />
</MapActionButton>
)