Continuation redux, push pour fusionner avec le master

pull/4/head
Pierre Ferreira 2 years ago
parent 594d58c0d8
commit a55a45e62b

@ -14,22 +14,22 @@
"@react-navigation/native-stack": "^6.9.10",
"@react-navigation/stack": "^6.3.14",
"@reduxjs/toolkit": "^1.9.3",
"expo": "~47.0.12",
"expo-status-bar": "~1.4.2",
"react": "18.1.0",
"react-dom": "18.1.0",
"react-native": "0.70.5",
"react-native-gesture-handler": "~2.8.0",
"react-native-safe-area-context": "^4.5.0",
"react-native-web": "~0.18.9",
"expo": "^48.0.0",
"expo-status-bar": "~1.4.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.71.3",
"react-native-gesture-handler": "~2.9.0",
"react-native-safe-area-context": "4.5.0",
"react-native-web": "~0.18.11",
"react-redux": "^8.0.5",
"redux": "^4.2.1"
},
"devDependencies": {
"@babel/core": "^7.12.9",
"@types/react": "~18.0.14",
"@babel/core": "^7.20.0",
"@types/react": "~18.0.27",
"@types/react-native": "~0.70.6",
"typescript": "^4.6.3"
"typescript": "^4.9.4"
},
"private": true
}

@ -1,6 +1,6 @@
import { setCardsList } from "./action_setCardsList";
//! se fichier devra possiblement changer de dossier !!!
//! classe pour tester
export class Card {
@ -52,6 +52,7 @@ export const getAllCards = () => {
//call the action
dispatch(setCardsList(CardsList));
} catch (error) {
console.log('Error---------', error);
//You can dispatch to another action if you want to display an error message in the application

@ -1,8 +1,16 @@
import { StyleSheet, Text, View, Button } from 'react-native';
import { StyleSheet, Text, View, Button, TouchableHighlight } from 'react-native';
import { StatusBar } from 'expo-status-bar';
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import { FlatList } from 'react-native-gesture-handler';
import {useDispatch, useSelector} from 'react-redux';
import { ThunkAction } from 'redux-thunk';
//? possiblement à supprimer
import { Card, getAllCards } from "../redux/actions/getAllCards"
export const DATA = [
@ -39,9 +47,30 @@ const Item = ({title}) => (
</View>
);
export default function Main(){
//@ts-ignore
export default function ListScreen({navigation}){
const [count, setCount] = useState(0);
// // Initialize the binding content with the application initial state
// //@ts-ignore
// const nList = useSelector(state => state.cards);
// // Create a const that will hold the react-redux events dispatcher
// const dispatch = useDispatch();
// // Let's define a hook that will be used to update the rendered state after the return will be called
// // You cannot perform side-effects outside of a useEffect hook
// useEffect(() => {
// const loadCards = async () => {
// await dispatch(getAllCards());
// };
// loadCards();
// }, [dispatch]);
return (
<View style={styles.container}>
<View style={styles.border}>
@ -53,6 +82,14 @@ export default function Main(){
<FlatList data={DATA}
renderItem={({item}) => <Item title={item.title} />}
keyExtractor={item => item.id}/>
{/* <FlatList data={nList} renderItem={({item}) =>
//<TouchableHighlight onPress={() => navigation.navigate("CardsDetails", {"card": item})}> //* mettre la page de detail ici, renvoi a home pour l'instant
<TouchableHighlight onPress={() => navigation.navigate("HomeScreen")}>
<Item title={item.name}/>
</TouchableHighlight>
} keyExtractor={(item: Card) => item.name}/> */}
</View>
);
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save