Projekt

Obecné

Profil

Stáhnout (1.26 KB) Statistiky
| Větev: | Tag: | Revize:
1
import { HStack, CircleIcon, View, ScrollView, Button } from "native-base";
2
import { CertaintyWithColors } from "../../stores/reducers/itemSlice";
3
import { Concordance } from "../../types/item";
4
import LoadingBox from "../loading/loadingBox";
5

    
6
// custom render Tab
7
const ItemTabBar = (props: { navigationState: { routes: any[] }, concordances : Concordance[], index: number, onIndexChange : any }) => {
8

    
9
    const {concordances, onIndexChange, index} = props 
10

    
11
    if (concordances && concordances.length > 0)
12
      return (
13
        <View h="16">
14
          <ScrollView horizontal={true} >
15
            <HStack>
16
              {props.navigationState.routes.map((route, i) => {
17
                return (
18
                  <Button size="lg" key={i}
19
                    variant={index == i ? "subtle" : "outline"}
20
                    rightIcon={<CircleIcon size="2" color={CertaintyWithColors[concordances[i].cert].color} />}
21
                    onPress={() => onIndexChange(i)}
22
                  >
23
                    {concordances[i].id}
24
                  </Button>
25
                );
26
              })}
27
            </HStack>
28
          </ScrollView>
29
        </View>
30
      )
31
    else {
32
      return <LoadingBox text={`Loading concordances...`}></LoadingBox>
33
    }
34
  };
35

    
36
  export default ItemTabBar
(1-1/2)