Projekt

Obecné

Profil

« Předchozí | Další » 

Revize e49b1f44

Přidáno uživatelem Schwobik před téměř 2 roky(ů)

Implementation of multiselect component, search page finished with listview
re #10478

Zobrazit rozdíly:

src/pages/SearchPage.tsx
1
import { Center, KeyboardAvoidingView, ScrollView, Text, VStack } from "native-base"
1
import {
2
    Button,
3
    Center,
4
    ChevronDownIcon,
5
    ChevronUpIcon, ScrollView,
6
    VStack
7
} from "native-base"
2 8
import ListView from "../components/listView/ListView"
3 9
import SearchForm from "../components/search/SearchForm"
4
import { Platform } from "react-native"
10
import { useEffect, useState } from "react"
11
import {
12
    fetchArtists, fetchCities, fetchCountries, fetchInstitutions,
13
    fetchInventories,
14
    fetchNationalities,
15
    fetchPlans,
16
    fetchSubjects, fetchTechniques
17
} from "../stores/actions/searchFormThunks"
18
import { useDispatch } from "react-redux"
19
import { AppDispatch } from "../stores/store"
20
import { log } from "../logging/logger"
5 21

  
6 22
const SearchPage = () => {
23
    const [isFilterOpen, setIsFilterOpen] = useState(true)
24

  
25
    const dispatch = useDispatch<AppDispatch>()
26

  
27
    useEffect(() => {
28
        log.debug("SearchPage", "useEffect", "fetchEverything")
29

  
30
        dispatch(fetchInventories())
31
        dispatch(fetchNationalities())
32
        dispatch(fetchArtists())
33
        dispatch(fetchSubjects())
34
        dispatch(fetchPlans())
35
        dispatch(fetchTechniques())
36
        dispatch(fetchCountries())
37
        dispatch(fetchCities())
38
        dispatch(fetchInstitutions())
39

  
40
        log.debug("SearchPage", "useEffect", "fetchEverything", "done")
41
    }, [dispatch])
7 42

  
8 43
    return (
9
        <KeyboardAvoidingView
10
            h={ {
11
                lg: "auto"
12
            } }
13
            behavior={ Platform.OS === "ios" ? "padding" : "height" }
14
        >
15
            <ScrollView>
16
                <VStack>
17
                    <SearchForm/>
44
        <Center m={ 2 } mr={ 4 } flex={1}>
45
            <Button
46
                alignSelf={ "start" }
47
                onPress={ () => setIsFilterOpen(!isFilterOpen) }
48
                variant="outline"
49
                endIcon={
50
                    <>
51
                        { isFilterOpen ?
52
                            (<ChevronUpIcon size={ 4 } color={ "primary.500" }/>)
53
                            : (<ChevronDownIcon size={ 4 } color={ "primary.500" }/>) }
54
                    </>
55
                }
56
                flexWrap={ "nowrap" }
57
                borderColor={ "primary.500" }
58
                mb={ 2 }
59
            >
60
                Filter
61
            </Button>
62
            <ScrollView flex={1} w={"100%"} >
63
                <VStack space={ 1 }>
64
                    <SearchForm isFilterOpen={ isFilterOpen }/>
18 65
                    <ListView/>
19 66
                </VStack>
20 67
            </ScrollView>
21
        </KeyboardAvoidingView>
68
        </Center>
22 69
    )
23 70
}
24 71

  

Také k dispozici: Unified diff