Skip to content

Commit

Permalink
category screen
Browse files Browse the repository at this point in the history
fix detail title and back logic
  • Loading branch information
hashiqi12138 committed Aug 12, 2021
1 parent ec9c036 commit ea9d8f8
Show file tree
Hide file tree
Showing 15 changed files with 525 additions and 66 deletions.
16 changes: 9 additions & 7 deletions App/API/Comic.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import API from './BasicRequest';
import {API_ABILITY} from './APIConstant';

const GetLatestComic = async (): Promise<Array<any>> => {
const latest = await API.GET(API_ABILITY.API_COMIC_LATEST).catch(() => {
return [];
});
const GetLatestComic = async (pageNo: number = 0): Promise<Array<any>> => {
const latest = await API.GET(API_ABILITY.API_COMIC_LATEST, {pageNo}).catch(
() => {
return [];
},
);
return latest;
};

Expand All @@ -17,7 +19,7 @@ const GetComicDetail = async (albumId: string): Promise<any> => {
const detail = await API.GET(API_ABILITY.API_COMIC_DETAIL, {
id: albumId,
})
.then((res) => {
.then(res => {
if (res && res.images) {
res.images.sort(sortBy);
}
Expand All @@ -35,7 +37,7 @@ const GetComicChapter = async (series_id: string) => {
const detail = await API.GET(API_ABILITY.API_COMIC_CHAPTER, {
id: series_id,
})
.then((res) => {
.then(res => {
console.log('get chapter', res);
return res;
})
Expand All @@ -47,7 +49,7 @@ const GetComicChapter = async (series_id: string) => {
};

const getRandomComic = async () => {
const random = await API.GET(API_ABILITY.API_COMIC_LATEST).catch((err) => {
const random = await API.GET(API_ABILITY.API_COMIC_LATEST).catch(err => {
console.error(err);
return [];
});
Expand Down
22 changes: 22 additions & 0 deletions App/JMApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import ExploreScreen from './Screens/ExploreScreen';
import CategoriesScreen from './Screens/CategoriesScreen';
import ComicDetailScreen from './Screens/ComicDetailScreen';
import ComicReaderScreen from './Screens/ComicReaderScreen';
import VideoScreen from './Screens/VideoScreen';
import AnimeScreen from './Screens/AnimeScreen';
import Icon from 'react-native-vector-icons/MaterialIcons';
import {PermissionsAndroid} from 'react-native';

Expand Down Expand Up @@ -41,6 +43,26 @@ function AllTabs() {
}}
component={CategoriesScreen}
/>
<BottomTabNav.Screen
name="Video"
options={{
tabBarLabel: '小电影',
tabBarIcon: ({color}) => (
<Icon color={color} size={24} name="personal-video" />
),
}}
component={VideoScreen}
/>
<BottomTabNav.Screen
name="Anime"
options={{
tabBarLabel: '动漫',
tabBarIcon: ({color}) => (
<Icon color={color} size={24} name="video-collection" />
),
}}
component={AnimeScreen}
/>
</BottomTabNav.Navigator>
);
}
Expand Down
38 changes: 38 additions & 0 deletions App/Screens/AnimeScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import {View, StyleSheet} from 'react-native';
import {Text} from 'react-native-elements';
import * as React from 'react';
import API from '../API/BasicRequest';
import {API_ABILITY} from '../API/APIConstant';

function fetchVideos(pageNo: number = 1, query: string = '') {
const params = {
video_type: 'video',
page: pageNo,
search_query: query,
};
return API.GET(API_ABILITY.API_VIDEOS_LIST, params).then(res => {
console.log(res);
});
}

const globalStyle = StyleSheet.create({
text: {
textAlign: 'center',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});

function AnimeScreen() {
React.useEffect(() => {
fetchVideos();
}, []);
return (
<View style={globalStyle.text}>
<Text>Anime</Text>
</View>
);
}

export default AnimeScreen;
Loading

0 comments on commit ea9d8f8

Please sign in to comment.