Projekt

Obecné

Profil

Stáhnout (1.78 KB) Statistiky
| Větev: | Tag: | Revize:
1 e49b1f44 Schwobik
import {
2
    Center,
3 4da7b143 Schwobik
    ScrollView,
4 e49b1f44 Schwobik
    VStack
5
} from "native-base"
6 9c55d3bb Schwobik
import ListView from "../components/listView/ListView"
7
import SearchForm from "../components/search/SearchForm"
8 4da7b143 Schwobik
import { useEffect } from "react"
9 e49b1f44 Schwobik
import {
10 4da7b143 Schwobik
    fetchArtists,
11
    fetchCities,
12
    fetchCountries,
13
    fetchInstitutions,
14 e49b1f44 Schwobik
    fetchInventories,
15
    fetchNationalities,
16
    fetchPlans,
17 4da7b143 Schwobik
    fetchSubjects,
18
    fetchTechniques
19 e49b1f44 Schwobik
} from "../stores/actions/searchFormThunks"
20
import { useDispatch } from "react-redux"
21
import { AppDispatch } from "../stores/store"
22
import { log } from "../logging/logger"
23 04928342 Schwobik
import { DrawerScreenProps } from "@react-navigation/drawer"
24 4da7b143 Schwobik
import { RootDrawerParamList } from "./Navigation"
25 b7014ba2 Schwobik
26 e49b1f44 Schwobik
27 4da7b143 Schwobik
const SearchPage = ({route, navigation}: DrawerScreenProps<RootDrawerParamList, 'Search'>) => {
28 e49b1f44 Schwobik
    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 b7014ba2 Schwobik
46 4da7b143 Schwobik
47
    useEffect(() => {
48
        log.debug("SearchPage", "props", route.params.inventoryId)
49
    }, [])
50
51 b7014ba2 Schwobik
    return (
52 1980ed09 Schwobik
        <Center m={ 2 } mr={0} mb={6} flex={1}>
53
54 e49b1f44 Schwobik
            <ScrollView flex={1} w={"100%"} >
55 1980ed09 Schwobik
                <VStack space={ 1 } mr={ 4 }>
56 4da7b143 Schwobik
                    <SearchForm inventoryId={route.params.inventoryId}/>
57 04928342 Schwobik
                    <ListView navigation={navigation}/>
58 ca53e9f1 Schwobik
                </VStack>
59
            </ScrollView>
60 e49b1f44 Schwobik
        </Center>
61 b7014ba2 Schwobik
    )
62
}
63
64
export default SearchPage