1- import React from 'react'
2- import { View , Text } from 'react-native'
1+ import React , { useState } from 'react'
2+ import { View , Text , ActivityIndicator , TouchableOpacity } from 'react-native'
3+ import { COLORS , SIZES } from '../../../constants'
4+ import NearbyJobCard from '../../common/cards/nearby/NearbyJobCard'
5+
6+ import { useRouter } from 'expo-router'
7+ import useFetch from '../../../hook/useFetch'
38
49import styles from './nearbyjobs.style'
510
611const Nearbyjobs = ( ) => {
12+ const router = useRouter ( ) ;
13+ const { data, isLoading, error, refetch } = useFetch ( 'search' , {
14+ query : 'Python developer in Kolkata, India' ,
15+ page : '1' ,
16+ num_pages : '1'
17+ } )
18+
719 return (
8- < View >
9- < Text > Nearbyjobs</ Text >
20+ < View style = { styles . container } >
21+ < View style = { styles . header } >
22+ < Text style = { styles . headerTitle } > Near By Jobs</ Text >
23+ < TouchableOpacity > < Text style = { styles . headerBtn } > Show all</ Text > </ TouchableOpacity >
24+ </ View >
25+ < View style = { styles . cardsContainer } >
26+ { isLoading ? (
27+ < ActivityIndicator size = "large" color = { COLORS . primary } />
28+ ) : error ? (
29+ < Text > Something went worng</ Text >
30+ ) : (
31+ data ?. map ( ( job ) => (
32+ < NearbyJobCard
33+ job = { job }
34+ key = { `nearby-${ job ?. job_id } ` }
35+ handleNavigate = { ( ) => router . push ( `/job-details/${ job ?. job_id } ` ) }
36+ />
37+ ) )
38+ ) }
39+ </ View >
1040 </ View >
1141 )
1242}
1343
14- export default Nearbyjobs
44+ export default Nearbyjobs ;
0 commit comments