Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 000ecc2f

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

adding redux for user state management and testing loading images

Zobrazit rozdíly:

package.json
16 16
    "native-base": "^3.4.28",
17 17
    "react": "18.2.0",
18 18
    "react-native": "0.71.4",
19
    "react-native-deck-swiper": "^2.0.13",
19 20
    "react-native-safe-area-context": "4.5.0",
20 21
    "react-native-svg": "13.4.0",
21 22
    "redux": "^4.2.1",
src/pages/LoginPage.tsx
4 4
let text: number = 199
5 5
const fakeLogin = async () => {
6 6
    text = 101
7
    console.log("zmacknuto")
8 7
    axiosInstance.post(
9 8
        '/api/login/',
10 9
        {"username": "viktorie", "password": "Golem123."}
src/pages/ScrollViewTest.tsx
1
import { Center, Box, Heading, VStack, FormControl, Link, Input, Button, HStack, Text, ScrollView } from "native-base"
1
import {
2
    Center,
3
    Box,
4
    Heading,
5
    VStack,
6
    FormControl,
7
    Link,
8
    Input,
9
    Button,
10
    HStack,
11
    Text,
12
    ScrollView,
13
    Image
14
} from "native-base"
2 15
import { axiosInstance } from "../api/api"
3 16

  
4 17

  
5 18

  
6 19
const ScrollViewTest = () => {
7
    const colors = ["red.200", "orange.200", "yellow.200", "green.200", "teal.200", "blue.200", "cyan.200", "purple.200", "pink.200"]
20
    const images = ["VieB-7.jpg", "VieB-10.jpg", "VieB-11.jpg", "VieB-14.jpg", "VieB-15.jpg"]
8 21

  
9 22
    return (
10 23
        <ScrollView>
......
57 70
                    </VStack>
58 71
                </Box>
59 72
                <ScrollView horizontal={true}>
60
                    {colors.map((color, index) => (
61
                        <Box
62
                            key={index}
63
                            bg={color}
64
                            w="150"
65
                            h="150"
66
                            marginX={5}
67
                        >
68
                        </Box>
73
                    {images.map((name, index) => (
74
                        <Image
75
                            source={{uri: "http://147.228.173.159/static/images/"+name}}
76
                            w={150}
77
                            h={150}
78
                            marginX={2}
79
                            alt={name}
80
                        />
69 81
                    ))}
70 82
                </ScrollView>
83

  
71 84
            </Center>
72 85
        </ScrollView>
73 86
    )
src/stores/actions/userThunks.ts
12 12
            }
13 13
        )
14 14
        if (response.status === 200) {
15
            return response.data
15
            return {
16
                username: payload.username,
17
                role: response.data.role
18
            }
16 19
        } else {
17 20
            return Promise.reject(response.data ? response.data : "Login failed")
18 21
        }

Také k dispozici: Unified diff