Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: [게시글 상세 조회] 사진 슬라이더 #67

Merged
merged 6 commits into from
Jul 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
node {
stage ('clone') {
checkout scm
}
stage('build') {
sh 'cd back'
sh 'cd back'
sh './gradlew clean build'
}
}
6 changes: 5 additions & 1 deletion front/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/**
* @author kouz95
*/

import React from "react";
import BottomTabNavigation from "./src/components/BottomTabNavigation";
import { NavigationContainer } from "@react-navigation/native";
import { RecoilRoot } from "recoil/dist";
import BottomTabNavigation from "./src/components/BottomTabNavigation";

export default function App() {
return (
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/ArticleAuthor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import AuthorAvatar from "./AuthorAvatar";
import AuthorName from "./AuthorName";
import AuthorScore from "./AuthorScore";
import AuthorTheCheat from "./AuthorTheCheat";
import { AuthorScoreType, AuthorAvatarType } from "../types/types";
import { AuthorAvatarType, AuthorScoreType } from "../types/types";

interface ArticleAuthorProps {
name: string;
Expand Down
4 changes: 2 additions & 2 deletions front/src/components/ArticleCreateScreenModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import { useNavigation } from "@react-navigation/native";
import { useRecoilState } from "recoil/dist";
import {
Modal,
View,
StyleSheet,
Text,
TouchableHighlight,
StyleSheet,
View,
} from "react-native";
import { articleModalActivationState } from "../states/articleState";
import { ArticleCreateModalNavigationProp } from "../types/types";
Expand Down
53 changes: 53 additions & 0 deletions front/src/components/ArticleDetailImageSlider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* @author kouz95
*/

import React from "react";
import ImageBox from "./ImageBox";
import { ImageURISource, StyleSheet, TouchableOpacity } from "react-native";

import Swiper from "react-native-swiper";
import ActiveDot from "./ActiveDot";
import { useNavigation } from "@react-navigation/native";
import { ImageSliderNavigationProp } from "../types/types";
import Dot from "./Dot";

interface ImageSliderProps {
images: ImageURISource[];
}

export default function ArticleDetailImageSlider({ images }: ImageSliderProps) {
const navigation = useNavigation<ImageSliderNavigationProp>();
return (
<Swiper
loadMinimal={true}
loop={false}
dot={<Dot />}
activeDot={<ActiveDot />}
paginationStyle={styles.pagination}
centerContent={true}
>
{images.map((imageURISource, index) => (
<TouchableOpacity
activeOpacity={1}
style={styles.buttonOnImage}
key={index}
onPress={() =>
navigation.navigate("ArticleDetailImageViewScreen", { images })
}
>
<ImageBox imageURI={imageURISource} marginBottom={0} />
</TouchableOpacity>
))}
</Swiper>
);
}

const styles = StyleSheet.create({
pagination: {
bottom: 15,
},
buttonOnImage: {
flex: 1,
},
});
43 changes: 43 additions & 0 deletions front/src/components/ArticleDetailImageViewSlider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/**
* @author kouz95
*/

import React from "react";
import ImageBox from "./ImageBox";
import { ImageURISource, StyleSheet } from "react-native";
import ImageViewSliderDot from "./ImageViewSliderDot";
import Swiper from "react-native-swiper";
import ActiveDot from "./ActiveDot";

interface ImageSliderProps {
images: ImageURISource[];
}

export default function ArticleDetailImageViewSlider({
images,
}: ImageSliderProps) {
return (
<Swiper
loadMinimal={true}
loop={false}
dot={<ImageViewSliderDot />}
activeDot={<ActiveDot />}
paginationStyle={styles.pagination}
centerContent={true}
style={styles.container}
>
{images.map((imageURISource, index) => (
<ImageBox imageURI={imageURISource} key={index} marginBottom={50} />
))}
</Swiper>
);
}

const styles = StyleSheet.create({
container: {
backgroundColor: "black",
},
pagination: {
bottom: 30,
},
});
2 changes: 1 addition & 1 deletion front/src/components/AuthorName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import React from "react";
import { View, Text, StyleSheet } from "react-native";
import { StyleSheet, Text, View } from "react-native";

interface AuthorNameProps {
name: string;
Expand Down
5 changes: 1 addition & 4 deletions front/src/components/Dot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ const styles = StyleSheet.create({
width: 5,
height: 5,
borderRadius: 4,
marginLeft: 3,
marginRight: 3,
marginTop: 3,
marginBottom: 3,
margin: 3,
},
});
31 changes: 31 additions & 0 deletions front/src/components/ImageBox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* @author kouz95
*/

import React from "react";
import { Image, ImageURISource, StyleSheet, View } from "react-native";

interface ImageBoxProps {
imageURI: ImageURISource;
marginBottom: number;
}

export default function ImageBox({ imageURI, marginBottom }: ImageBoxProps) {
return (
<View style={styles.imageContainer || { marginBottom: marginBottom }}>
<Image source={imageURI} style={styles.image} />
</View>
);
}

const styles = StyleSheet.create({
imageContainer: {
flex: 1,
},
image: {
flex: 1,
width: "100%",
height: "100%",
resizeMode: "contain",
},
});
26 changes: 26 additions & 0 deletions front/src/components/ImageSliderNavigation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/**
* @author kouz95
*/

import React from "react";
import { createStackNavigator } from "@react-navigation/stack";
import ArticleDetailScreen from "../screens/ArticleDetailScreen";
import ArticleDetailImageViewScreen from "../screens/ArticleDetailImageViewScreen";
import { ImageSliderParamList } from "../types/types";

const Stack = createStackNavigator<ImageSliderParamList>();

export default function ImageSliderNavigation() {
return (
<Stack.Navigator>
<Stack.Screen
name="ArticleDetailScreen"
component={ArticleDetailScreen}
/>
<Stack.Screen
name="ArticleDetailImageViewScreen"
component={ArticleDetailImageViewScreen}
/>
</Stack.Navigator>
);
}
23 changes: 23 additions & 0 deletions front/src/components/ImageViewSliderDot.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @author kouz95
*/

import React from "react";
import { StyleSheet, View } from "react-native";

export default function ImageViewSliderDot() {
return <View style={styles.dot} />;
}

const styles = StyleSheet.create({
dot: {
backgroundColor: "rgba(224,224,224,0.3)",
width: 8,
height: 8,
borderRadius: 4,
marginLeft: 3,
marginRight: 3,
marginTop: 3,
marginBottom: 3,
},
});
2 changes: 1 addition & 1 deletion front/src/components/Photo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
} from "react-native";
import { AntDesign, MaterialCommunityIcons } from "@expo/vector-icons";
import {
PermissionStatus,
launchImageLibraryAsync,
MediaTypeOptions,
PermissionStatus,
} from "expo-image-picker";
import * as Permissions from "expo-permissions";
import NoticeModal from "./NoticeModal";
Expand Down
2 changes: 1 addition & 1 deletion front/src/components/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { useRecoilState, useSetRecoilState } from "recoil/dist";
import {
inputState,
isModalOpenState,
tagIdState,
tagBoxesState,
tagIdState,
} from "../states/TagState";

export default function Tag() {
Expand Down
2 changes: 1 addition & 1 deletion front/src/screens/ArticleContentsFormScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import React from "react";
import { StyleSheet, View, TextInput } from "react-native";
import { StyleSheet, TextInput, View } from "react-native";
import { articleContentsState } from "../states/articleState";
import { useRecoilState } from "recoil/dist";

Expand Down
20 changes: 10 additions & 10 deletions front/src/screens/ArticleCreateScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
* @author kouz95 lxxjn0
*/

import React, { useLayoutEffect, useEffect } from "react";
import React, { useEffect, useLayoutEffect } from "react";
import {
View,
Text,
BackHandler,
Button,
StyleSheet,
TouchableWithoutFeedback,
TouchableOpacity,
Keyboard,
Platform,
BackHandler,
StyleSheet,
Text,
TouchableOpacity,
TouchableWithoutFeedback,
View,
} from "react-native";
import { useNavigation } from "@react-navigation/native";
import { HeaderBackButton } from "@react-navigation/stack";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
import { EvilIcons, MaterialCommunityIcons } from "@expo/vector-icons";
import {
useSetRecoilState,
useResetRecoilState,
useRecoilValue,
useResetRecoilState,
useSetRecoilState,
} from "recoil/dist";
import ArticleTitleForm from "../components/ArticleTitleForm";
import ArticlePriceForm from "../components/ArticlePriceForm";
Expand All @@ -30,8 +30,8 @@ import Photo from "../components/Photo";
import Tag from "../components/Tag";
import {
articleContentsState,
articlePhotosState,
articleModalActivationState,
articlePhotosState,
articlePriceState,
articleSelectedCategoryState,
articleTitleState,
Expand Down
57 changes: 57 additions & 0 deletions front/src/screens/ArticleDetailImageViewScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* @author kouz95
*/

import React, { useLayoutEffect } from "react";
import { StatusBar, StyleSheet, View } from "react-native";

import ArticleDetailImageViewSlider from "../components/ArticleDetailImageViewSlider";
import { HeaderBackButton } from "@react-navigation/stack";
import {
ImageSliderNavigationProp,
ImageSliderParamList,
} from "../types/types";
import { RouteProp, useNavigation, useRoute } from "@react-navigation/native";
import { AntDesign } from "@expo/vector-icons";

export default function ArticleDetailImageViewScreen() {
const navigation = useNavigation<ImageSliderNavigationProp>();
const route = useRoute<
RouteProp<ImageSliderParamList, "ArticleDetailImageViewScreen">
>();

const goBackAndSetStatusBarVisible = () => {
navigation.goBack();
StatusBar.setHidden(false);
};

useLayoutEffect(() => {
navigation.setOptions({
title: "",
headerLeft: () => undefined,
headerRight: () => (
<HeaderBackButton
labelVisible={false}
onPress={goBackAndSetStatusBarVisible}
backImage={() => <AntDesign name="close" size={24} color="white" />}
/>
),
headerRightContainerStyle: { paddingRight: 20 },
headerStyle: {
backgroundColor: "black",
},
});
StatusBar.setHidden(true);
}, [navigation, route]);
return (
<View style={styles.container}>
<ArticleDetailImageViewSlider images={route.params.images} />
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
},
});
Loading