Avancement team info

Backend/Page/Team_Browser
mohamed 2 years ago
parent 5123771c8d
commit b9eb0b5444

@ -7,7 +7,7 @@ import LoginStack from './navigation/LoginStack';
import Navigation from './navigation/Navigation';
import ChangePassword from './screens/ChangePassword';
import CreateTeam from './screens/CreateTeam';
import InfoTeam from './screens/InfoTeam';
import Team_Info from './screens/Team_Info';
import Login from './screens/Login';
import ManageAccount from './screens/ManageAccount';
import NewTrack from './screens/NewTrack';

@ -1,16 +1,20 @@
import { View,Image,Text, StyleSheet } from "react-native";
import React from "react";
import { View,Image,Text, StyleSheet, Touchable } from "react-native";
import { TouchableOpacity } from "react-native-gesture-handler";
import { Team } from "../core/Team";
type TeamListItemProps = {
team: Team;
onPress: (team: Team) => void;
}
export default function TeamListItem(props: TeamListItemProps) {
return (
<View style={styles.container}>
<TouchableOpacity style={styles.container}
onPress={()=> props.onPress(props.team)}>
<Image style={styles.teaserImage} source={props.team.getLogo()} />
<Text style={styles.text_style}> {props.team.getName()}</Text>
</View>
</TouchableOpacity>
)
}
@ -21,7 +25,7 @@ type TeamListItemProps = {
padding:10,
flex: 1,
flexDirection: "row",
marginTop:10,
marginBottom:10,
},
text_style:{
marginLeft:15,

@ -1,6 +1,6 @@
import { createStackNavigator } from "@react-navigation/stack";
import CreateTeam from "../screens/CreateTeam";
import InfoTeam from "../screens/InfoTeam";
import Team_Info from "../screens/Team_Info";
import Team_Browser from "../screens/Team_Browser";
import Team_Selection from "../screens/Team_Selection";
@ -10,7 +10,7 @@ export default function TeamInfoStack() {
return (
<Stack.Navigator initialRouteName="Home" screenOptions={{ headerShown: false }}>
<Stack.Screen name="Home" component={Team_Browser} />
<Stack.Screen name="Info" component={InfoTeam} />
<Stack.Screen name="Info" component={Team_Info} />
</Stack.Navigator>
)
}

@ -3,6 +3,7 @@ import { FlatList, StyleSheet, Text, View, Image, TouchableOpacity } from 'react
import { SafeAreaView } from 'react-native-safe-area-context';
import MapView from 'react-native-maps';
import PROVIDER_OPENSTREETMAP, { Marker } from 'react-native-maps';
import React from 'react';
export default function Lap() {

@ -3,7 +3,7 @@ import React from 'react';
import { Button, Pressable } from 'react-native';
import { StyleSheet, Text, View, Image, TextInput } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { AsyncStorage } from 'react-native';
// import { AsyncStorage } from 'react-native';
export default function Login(props: { navigation: any }) {
@ -26,7 +26,7 @@ export default function Login(props: { navigation: any }) {
const secretKey = 'SECRET'; // appele API pour récupérer une clé secrete
const handleLogin = () => {
const isCorrect = false // envoi email + password a l'API, retour bool de l'API
const isCorrect = true // envoi email + password a l'API, retour bool de l'API
// If the email and password are correct, generate a JWT
if(isCorrect){

@ -1,24 +1,26 @@
import { Button, FlatList, Pressable, StyleSheet, Text, View } from 'react-native';
import { FlatList, StyleSheet, Text, View } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
import { SearchBar } from '@rneui/base';
import { TouchableHighlight } from 'react-native-gesture-handler';
import React from 'react';
import React, { useState } from 'react';
import { TEAMS } from '../stub/stub';
import TeamListItem from '../components/TeamCmp';
import { Team } from '../core/Team';
export default function Team_Browser(props: { navigation: any }) {
const { navigation } = props;
const state = {
search: '',
};
const [search, setSearch] = useState('');
const updateSearch = (search: string) => {
state.search=search;
const handlePress = (item: Team) => {
setSearch('');
navigation.navigate('Info', { "": item }); // A revoir
};
const { search } = state;
const filteredData = search !== '' ? TEAMS.filter((item) =>
item.getName().toLowerCase().includes(search.toLowerCase())
) : TEAMS;
return (
<SafeAreaView style={styles.container}>
@ -27,10 +29,12 @@ export default function Team_Browser(props: { navigation: any }) {
<SearchBar
platform="default"
lightTheme
value={search}
onChangeText={setSearch}
/>
<FlatList
data={TEAMS}
renderItem={({ item }) => <TeamListItem team={item} />} />
data={filteredData}
renderItem={({ item }) => <TeamListItem team={item} onPress={handlePress}/>} />
</View>
</SafeAreaView>

@ -3,7 +3,7 @@ import { Button, Pressable } from 'react-native';
import { StyleSheet, Text, View, Image } from 'react-native';
import { SafeAreaView } from 'react-native-safe-area-context';
export default function InfoTeam(props: { navigation: any }) {
export default function Team_Info(props: { navigation: any }) {
const { navigation } = props;
return (
<SafeAreaView style={styles.container}>
Loading…
Cancel
Save