Skip to content

Commit 67444b1

Browse files
chore: change navigation to sign in from landing screen
1 parent f392a21 commit 67444b1

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/screens/LandingScreen.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
import { KeyboardAwareScrollView, LandingHeader } from '@baca/components'
2-
import { BACA_APP_URL, BACA_DOCS_URL } from '@baca/constants'
2+
import { BACA_DOCS_URL } from '@baca/constants'
33
import { Button, Center, Text, Box } from '@baca/design-system'
44
import { useCallback, useScreenOptions, useTranslation } from '@baca/hooks'
55
import { draftImages } from '@baca/screens'
6+
import { useRouter } from 'expo-router'
67
import { useState, useEffect, useMemo } from 'react'
78
import { ImageSourcePropType, Linking, Image, Dimensions, StyleSheet } from 'react-native'
89

910
export const LandingScreen = () => {
1011
const { t } = useTranslation()
1112
const [screenWidth, setScreenWidth] = useState(Dimensions.get('window').width)
1213

14+
const { push } = useRouter()
15+
16+
const navigateToLogin = useCallback(() => push('/sign-in'), [push])
17+
const navigateToDocs = useCallback(() => Linking.openURL(BACA_DOCS_URL), [])
18+
1319
useEffect(() => {
1420
const onChange = ({ window }: { window: { width: number } }) => setScreenWidth(window.width)
1521
const subscription = Dimensions.addEventListener('change', onChange)
@@ -38,8 +44,6 @@ export const LandingScreen = () => {
3844
}
3945
}, [screenWidth])
4046

41-
const openLink = useCallback((url: string) => Linking.openURL(url), [])
42-
4347
const renderItem = (item: ImageSourcePropType, index: number) => (
4448
<Box key={index} width={imageWidth} px={paddingBetweenImages} pb={paddingBetweenImages}>
4549
<Box style={{ aspectRatio: 9 / 16 }} height="100%" borderRadius={16} bg="bg.active">
@@ -64,10 +68,10 @@ export const LandingScreen = () => {
6468
</Text.LgRegular>
6569

6670
<Box alignItems="center" flexDirection="row" flexWrap="wrap" justifyContent="center" mt={4}>
67-
<Button m={3} h={12} minWidth={160} onPress={() => openLink(BACA_DOCS_URL)}>
71+
<Button m={3} h={12} minWidth={160} onPress={navigateToDocs}>
6872
{t('home_screen.read_docs')}
6973
</Button>
70-
<Button.SecondaryColor m={3} h={12} minWidth={160} onPress={() => openLink(BACA_APP_URL)}>
74+
<Button.SecondaryColor m={3} h={12} minWidth={160} onPress={navigateToLogin}>
7175
{t('home_screen.try_it')}
7276
</Button.SecondaryColor>
7377
</Box>

0 commit comments

Comments
 (0)