import { StyleSheet, Text, View, Button } from 'react-native'; import { StatusBar } from 'expo-status-bar'; import React, { useState } from "react"; //? possiblement à supprimer import { getAllCards } from "../redux/actions/actionSelection" import { Card } from '../models/Card'; import { Image } from 'react-native'; import { ImageURISource } from 'react-native'; import { switchMode } from '../redux/actions/action_switchMode'; //@ts-ignore const Item = ({url}) => ( // // {title} // ); //@ts-ignore export default function ListScreen({navigation}){ const [count, setCount] = useState(0); // get the current theme //@ts-ignore const theme = useSelector(state => state.theme); // // Initialize the binding content with the application initial state //@ts-ignore const nList = useSelector(state => state.appReducer.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 () => { //@ts-ignore await dispatch(getAllCards()); }; loadCards(); }, [dispatch]); //* Stub // const {getCards} = new StubLib(); // const list: Card[] = getCards(); // const req = fetch('https://omgvamp-hearthstone-v1.p.rapidapi.com/cards') //https://us.api.blizzard.com/hearthstone/cards/678?locale=en_US //* Themes *// // define a component mode state const [mode, setMode] = useState(theme.mode); // Handle changing the theme mode const handleThemeChange = () => { dispatch(switchMode(theme.mode === 'light' ? 'dark' : 'light')); } // Update the app Incase the theme mode changes useEffect(() => { setMode(theme.mode); }, [theme]); return ( {/* } keyExtractor={item => item.id}/> */}