Skip to content

Commit

Permalink
feat: add event map (#22)
Browse files Browse the repository at this point in the history
* feat: scaffold event map tab

* feat: add zoomable map
  • Loading branch information
antoKeinanen authored Jul 14, 2024
1 parent f718202 commit f4670d9
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 2 deletions.
8 changes: 8 additions & 0 deletions app/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export default function TabLayout() {
),
}}
/>
<Tabs.Screen
name='map'
options={{
tabBarIcon: ({ color, focused }) => (
<TabBarIcon name={focused ? 'map' : 'map-outline'} color={color} />
),
}}
/>
</Tabs>
);
}
23 changes: 23 additions & 0 deletions app/(tabs)/map.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import AppBar from '@/elements/AppBar';
import EventMap from '@/elements/map/EventMap';
import { Surface } from 'react-native-paper';
import { useTheme } from 'react-native-paper';
import { useSafeAreaInsets } from 'react-native-safe-area-context';

export default function MapScreen() {
const theme = useTheme();
const insets = useSafeAreaInsets();

return (
<Surface
style={{
height: '100%',
backgroundColor: theme.colors.background,
paddingTop: insets.top,
}}
>
<AppBar title='map' />
<EventMap />
</Surface>
);
}
Binary file added assets/images/summer23-aluekartta.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions elements/map/EventMap.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { ReactNativeZoomableView } from '@openspacelabs/react-native-zoomable-view';
import { Image, View } from 'react-native';

function EventMap() {
return (
<ReactNativeZoomableView
maxZoom={2.5}
minZoom={0.5}
zoomStep={0.5}
initialZoom={1}
bindToBorders={true}
style={{
width: 'fit-content',
}}
// Image dimensions
contentWidth={1024}
contentHeight={576}
>
<View style={{ width: '100%' }}>
<Image
style={{ objectFit: 'contain' }}
source={require('@/assets/images/summer23-aluekartta.png')}
/>
</View>
</ReactNativeZoomableView>
);
}

export default EventMap;
1 change: 1 addition & 0 deletions locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
translation: {
home: 'Home',
timetable: 'Timetable',
map: 'Map',
location: 'Location',
time: 'Time',
'select-language': 'Select Language',
Expand Down
1 change: 1 addition & 0 deletions locales/fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export default {
translation: {
home: 'Koti',
timetable: 'Aikataulu',
map: "Kartta",
location: 'Sijainti',
time: 'Aika',
'select-language': 'Valitse kieli',
Expand Down
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
},
"dependencies": {
"@expo/vector-icons": "^14.0.0",
"@openspacelabs/react-native-zoomable-view": "^2.1.6",
"@react-native-async-storage/async-storage": "1.23.1",
"@react-navigation/native": "^6.0.2",
"dayjs": "^1.11.11",
"expo": "~51.0.14",
Expand All @@ -43,8 +45,7 @@
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "^4.10.1",
"react-native-screens": "3.31.1",
"react-native-web": "~0.19.10",
"@react-native-async-storage/async-storage": "1.23.1"
"react-native-web": "~0.19.10"
},
"devDependencies": {
"@babel/core": "^7.20.0",
Expand Down

0 comments on commit f4670d9

Please sign in to comment.