1
|
import {
|
2
|
Center,
|
3
|
ScrollView,
|
4
|
VStack
|
5
|
} from "native-base"
|
6
|
import ListView from "../components/listView/ListView"
|
7
|
import SearchForm from "../components/search/SearchForm"
|
8
|
import { useEffect } from "react"
|
9
|
import {
|
10
|
fetchArtists,
|
11
|
fetchCities,
|
12
|
fetchCountries,
|
13
|
fetchInstitutions,
|
14
|
fetchInventories,
|
15
|
fetchNationalities,
|
16
|
fetchPlans,
|
17
|
fetchSubjects,
|
18
|
fetchTechniques
|
19
|
} from "../stores/actions/searchFormThunks"
|
20
|
import { useDispatch } from "react-redux"
|
21
|
import { AppDispatch } from "../stores/store"
|
22
|
import { log } from "../logging/logger"
|
23
|
import { DrawerScreenProps } from "@react-navigation/drawer"
|
24
|
import { RootDrawerParamList } from "./Navigation"
|
25
|
|
26
|
|
27
|
const SearchPage = ({route, navigation}: DrawerScreenProps<RootDrawerParamList, 'Search'>) => {
|
28
|
const dispatch = useDispatch<AppDispatch>()
|
29
|
|
30
|
useEffect(() => {
|
31
|
log.debug("SearchPage", "useEffect", "fetchEverything")
|
32
|
|
33
|
dispatch(fetchInventories())
|
34
|
dispatch(fetchNationalities())
|
35
|
dispatch(fetchArtists())
|
36
|
dispatch(fetchSubjects())
|
37
|
dispatch(fetchPlans())
|
38
|
dispatch(fetchTechniques())
|
39
|
dispatch(fetchCountries())
|
40
|
dispatch(fetchCities())
|
41
|
dispatch(fetchInstitutions())
|
42
|
|
43
|
log.debug("SearchPage", "useEffect", "fetchEverything", "done")
|
44
|
}, [dispatch])
|
45
|
|
46
|
|
47
|
useEffect(() => {
|
48
|
log.debug("SearchPage", "props", route.params.inventoryId)
|
49
|
}, [])
|
50
|
|
51
|
return (
|
52
|
<Center m={ 2 } mr={0} mb={6} flex={1}>
|
53
|
|
54
|
<ScrollView flex={1} w={"100%"} >
|
55
|
<VStack space={ 1 } mr={ 4 }>
|
56
|
<SearchForm inventoryId={route.params.inventoryId}/>
|
57
|
<ListView navigation={navigation}/>
|
58
|
</VStack>
|
59
|
</ScrollView>
|
60
|
</Center>
|
61
|
)
|
62
|
}
|
63
|
|
64
|
export default SearchPage
|