Search courses show in two cols

This commit is contained in:
Adolfo Reyna
2023-03-10 19:41:30 -06:00
parent f792125eee
commit eae0992ccb

View File

@@ -122,6 +122,9 @@ const Courses = () => {
const watchingCourse = (({ item }) => { const watchingCourse = (({ item }) => {
return (<CourseCard profileObj={item.profile} />); return (<CourseCard profileObj={item.profile} />);
}); });
const renderCoursesQuery = (({ item }) => {
return (<CourseCard profileObj={item} twoCols={true}/>);
});
return ( return (
<SafeAreaView style={styles.container}> <SafeAreaView style={styles.container}>
<Searchbar <Searchbar
@@ -132,7 +135,7 @@ const Courses = () => {
{groups.length ? <></> : <ActivityIndicator />} {groups.length ? <></> : <ActivityIndicator />}
<ScrollView> <ScrollView>
{ {
watching.length ? (searchQuery.length === 0 && watching.length) ?
<View> <View>
<Title style={styles.title} >{i18n.t("message.continueWatching")}:</Title> <Title style={styles.title} >{i18n.t("message.continueWatching")}:</Title>
<FlatList <FlatList
@@ -145,7 +148,7 @@ const Courses = () => {
</View> : <></> </View> : <></>
} }
{ {
groups.length ? (searchQuery.length === 0 && groups.length) ?
<> <>
<Title style={styles.title} >{i18n.t("message.recentlyAdded")}:</Title> <Title style={styles.title} >{i18n.t("message.recentlyAdded")}:</Title>
<FlatList <FlatList
@@ -158,7 +161,7 @@ const Courses = () => {
</> : <></> </> : <></>
} }
{ {
popular.length ? (searchQuery.length === 0 && popular.length) ?
<> <>
<Title style={styles.title} >{i18n.t("message.popularCourses")}:</Title> <Title style={styles.title} >{i18n.t("message.popularCourses")}:</Title>
<FlatList <FlatList
@@ -170,6 +173,19 @@ const Courses = () => {
/> />
</> : <></> </> : <></>
} }
{
(searchQuery.length !== 0 && groups.length) ?
<>
<FlatList
//horizontal={true}
data={groups}
numColumns={2}
renderItem={renderCoursesQuery}
keyExtractor={item => item._id}
initialNumToRender={8}
/>
</> : <></>
}
</ScrollView> </ScrollView>
</SafeAreaView> </SafeAreaView>
) )