1
1
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'
3
3
import { Button , Center , Text , Box } from '@baca/design-system'
4
4
import { useCallback , useScreenOptions , useTranslation } from '@baca/hooks'
5
5
import { draftImages } from '@baca/screens'
6
+ import { useRouter } from 'expo-router'
6
7
import { useState , useEffect , useMemo } from 'react'
7
8
import { ImageSourcePropType , Linking , Image , Dimensions , StyleSheet } from 'react-native'
8
9
9
10
export const LandingScreen = ( ) => {
10
11
const { t } = useTranslation ( )
11
12
const [ screenWidth , setScreenWidth ] = useState ( Dimensions . get ( 'window' ) . width )
12
13
14
+ const { push } = useRouter ( )
15
+
16
+ const navigateToLogin = useCallback ( ( ) => push ( '/sign-in' ) , [ push ] )
17
+ const navigateToDocs = useCallback ( ( ) => Linking . openURL ( BACA_DOCS_URL ) , [ ] )
18
+
13
19
useEffect ( ( ) => {
14
20
const onChange = ( { window } : { window : { width : number } } ) => setScreenWidth ( window . width )
15
21
const subscription = Dimensions . addEventListener ( 'change' , onChange )
@@ -38,8 +44,6 @@ export const LandingScreen = () => {
38
44
}
39
45
} , [ screenWidth ] )
40
46
41
- const openLink = useCallback ( ( url : string ) => Linking . openURL ( url ) , [ ] )
42
-
43
47
const renderItem = ( item : ImageSourcePropType , index : number ) => (
44
48
< Box key = { index } width = { imageWidth } px = { paddingBetweenImages } pb = { paddingBetweenImages } >
45
49
< Box style = { { aspectRatio : 9 / 16 } } height = "100%" borderRadius = { 16 } bg = "bg.active" >
@@ -64,10 +68,10 @@ export const LandingScreen = () => {
64
68
</ Text . LgRegular >
65
69
66
70
< 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 } >
68
72
{ t ( 'home_screen.read_docs' ) }
69
73
</ 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 } >
71
75
{ t ( 'home_screen.try_it' ) }
72
76
</ Button . SecondaryColor >
73
77
</ Box >
0 commit comments