Improve video and padding in tabs
This commit is contained in:
@@ -43,9 +43,28 @@ const getCourses = async (profileObj) => {
|
||||
});
|
||||
});
|
||||
return {
|
||||
courses,
|
||||
popular,
|
||||
watching: watchingArray,
|
||||
courses: courses.slice(0,10),
|
||||
popular: popular.slice(0,10),
|
||||
watching: watchingArray.slice(0,10),
|
||||
}
|
||||
}
|
||||
|
||||
const storeCoursesCache = async (value) => {
|
||||
try {
|
||||
const jsonValue = JSON.stringify(value)
|
||||
await AsyncStorage.setItem('courses', jsonValue)
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
const getCoursesCache= async () => {
|
||||
try {
|
||||
const value = await AsyncStorage.getItem('courses')
|
||||
if (value !== null) {
|
||||
return JSON.parse(value);
|
||||
}
|
||||
} catch (e) {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,10 +78,18 @@ const Courses = () => {
|
||||
const [queryTimer, setQueryTimer] = React.useState(0);
|
||||
|
||||
useEffect(async () => {
|
||||
await getCoursesCache().then((r)=>{
|
||||
console.log("Courses Cache");
|
||||
setGroups(r.courses || []);
|
||||
setPopular(r.popular || []);
|
||||
setWatching(r.watching || []);
|
||||
});
|
||||
let r = await getCourses(viewer);
|
||||
console.log("Courses Live");
|
||||
setGroups(r.courses || []);
|
||||
setPopular(r.popular || []);
|
||||
setWatching(r.watching || []);
|
||||
storeCoursesCache(r);
|
||||
}, [])
|
||||
|
||||
const onChangeSearch = query => {
|
||||
@@ -102,6 +129,7 @@ const Courses = () => {
|
||||
data={watching}
|
||||
renderItem={watchingCourse}
|
||||
keyExtractor={item => item.profile._id}
|
||||
initialNumToRender={2}
|
||||
/>
|
||||
<Title>Recently Added:</Title>
|
||||
<FlatList
|
||||
@@ -109,6 +137,7 @@ const Courses = () => {
|
||||
data={groups}
|
||||
renderItem={renderProfile}
|
||||
keyExtractor={item => item._id}
|
||||
initialNumToRender={2}
|
||||
/>
|
||||
<Title>Popular:</Title>
|
||||
<FlatList
|
||||
@@ -116,6 +145,7 @@ const Courses = () => {
|
||||
data={popular}
|
||||
renderItem={renderProfile}
|
||||
keyExtractor={item => item._id}
|
||||
initialNumToRender={2}
|
||||
/>
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
@@ -126,5 +156,6 @@ export default Courses;
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1
|
||||
},
|
||||
});
|
||||
|
||||
@@ -39,7 +39,7 @@ const Groups = () => {
|
||||
return (<GroupCard profileObj={item} />);
|
||||
});
|
||||
return (
|
||||
<SafeAreaView>
|
||||
<SafeAreaView style={{flex: 1}}>
|
||||
<Searchbar
|
||||
placeholder="Search Groups"
|
||||
onChangeText={onChangeSearch}
|
||||
|
||||
@@ -72,6 +72,7 @@ let Profile = ({ navigation, route }) => {
|
||||
keyExtractor={item => item._id || item.createdAt}
|
||||
ListHeaderComponent={header}
|
||||
refreshing={Posts.length === 0}
|
||||
initialNumToRender={2}
|
||||
onRefresh={() => {
|
||||
API.getPosts(route.params.profileid).then(setPosts);
|
||||
}}
|
||||
|
||||
@@ -31,7 +31,7 @@ const Search = () => {
|
||||
return (<ProfileCard profileObj={item} />);
|
||||
});
|
||||
return (
|
||||
<SafeAreaView >
|
||||
<SafeAreaView style={{flex:1}}>
|
||||
<Searchbar
|
||||
placeholder="Search Users"
|
||||
onChangeText={onChangeSearch}
|
||||
|
||||
Reference in New Issue
Block a user