Skip to content

Commit

Permalink
Merge pull request #84 from Amattang/fix/#70-QA
Browse files Browse the repository at this point in the history
fix: QA
  • Loading branch information
11t518s authored Apr 6, 2022
2 parents 67f4027 + 4add07c commit cfc2bc5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 26 deletions.
41 changes: 20 additions & 21 deletions components/camera/CameraAndGallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@ interface IProps {

function CameraAndGallery({ setOnModal, onModal }: IProps) {
const checkListContext = useContext(checkListCtx);
const onPostCameraDataHandler = async (image: any) => {
const imageData = new FormData();

imageData.append('image', {
uri: Platform.OS === 'android' ? image.path : image.path.replace('file://', ''),
type: image.mime,
name: image.filename,
});
const onPostCameraDataHandler = async (images: any) => {
const imageData = await new FormData();

await images.map((image: any) =>
imageData.append('image', {
uri: Platform.OS === 'android' ? image.path : image.path.replace('file://', ''),
type: image.mime,
name: image.filename,
})
);
await axios
.post(`/api/check-list/${checkListContext?.checkListId}/image`, imageData)
.then((e) => {
Expand All @@ -32,6 +34,13 @@ function CameraAndGallery({ setOnModal, onModal }: IProps) {
console.log(e);
});
};
const onCamera = () =>
ImagePicker.openCamera({
cropping: true,
}).then((images: any) => {
onPostCameraDataHandler([images]);
setOnModal(!onModal);
});

const onPostImageDataHandler = async (images: any) => {
const imageData = new FormData();
Expand All @@ -46,11 +55,9 @@ function CameraAndGallery({ setOnModal, onModal }: IProps) {
await axios
.post(`/api/check-list/${checkListContext?.checkListId}/image`, imageData)
.then((e) => {
console.log('t');
console.log(e);
})
.catch((e) => {
console.log('c');
console.log(e);
});
};
Expand All @@ -63,23 +70,15 @@ function CameraAndGallery({ setOnModal, onModal }: IProps) {
setOnModal(!onModal);
});

const onCamera = () =>
ImagePicker.openCamera({
cropping: true,
}).then((image: any) => {
onPostCameraDataHandler(image);
setOnModal(!onModal);
});

return (
<Modal isVisible={true} onBackdropPress={() => setOnModal(!onModal)}>
<Pressable style={styles.modalWrapper} onPress={() => setOnModal(!onModal)}>
<View style={styles.cameraModalElementBtnWrapper}>
<Pressable style={styles.cameraModalEachBtn} onPress={onCamera}>
<DefaultText style={styles.cameraModalInnerText}>카메라</DefaultText>
</Pressable>
{/*<Pressable style={styles.cameraModalEachBtn} onPress={onCamera}>*/}
{/* <DefaultText style={styles.cameraModalInnerText}>카메라</DefaultText>*/}
{/*</Pressable>*/}

<View style={styles.horizantalLine} />
{/*<View style={styles.horizantalLine} />*/}

<Pressable style={styles.cameraModalEachBtn} onPress={onGallery}>
<DefaultText style={styles.cameraModalInnerText}>앨범</DefaultText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import MyItemOfBasicCheckList from '../../../../screens/BasicCheckList/MyItemOfB
import { mainLightBlue } from '../../../../color';
import FloatingBtn from '../../../../components/CheckListComponent/FloatingBtn';
import CameraAndGallery from '../../../../components/camera/CameraAndGallery';
import { Dimensions, SafeAreaView } from 'react-native';
import { useHeaderHeight } from 'react-native-screens/native-stack';

const Tab = createMaterialTopTabNavigator();

Expand Down
10 changes: 8 additions & 2 deletions navigation/Main/StackNavigation/StackNavigationOfCheckList.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Dispatch, SetStateAction, useContext, useEffect, useState } from 'react';
import { Image, Pressable, Share } from 'react-native';
import { Dimensions, Image, Pressable, SafeAreaView, Share } from 'react-native';

import BasicCheckList from './BasicCheckList/BasiclCheckList';
import { CheckListStackParamsList } from '../../../types/navigationTypes';
Expand All @@ -14,6 +14,7 @@ import {
import { checkListCtx } from '../../../Context/CheckListByServer';
import { useNavigation } from '@react-navigation/native';
import Map from '../../../screens/bottomTab/Map';
import { useHeaderHeight } from 'react-native-screens/native-stack';

const NativeStack = createNativeStackNavigator<CheckListStackParamsList>();

Expand Down Expand Up @@ -49,6 +50,7 @@ function CheckListStackNav({ setIsLogin }: IProps) {
checkListContext?.onChoseCheckListHandler();
setIsEdit(false);
};
const height = Dimensions.get('window').height;

const screenOptions: NativeStackNavigationOptions = {
animation: 'slide_from_bottom',
Expand Down Expand Up @@ -85,7 +87,11 @@ function CheckListStackNav({ setIsLogin }: IProps) {
/>
<NativeStack.Screen
name="basicCheckList"
children={() => <BasicCheckList isEdit={isEdit} setIsEdit={setIsEdit} />}
children={() => (
<SafeAreaView style={{ height: height - 55 }}>
<BasicCheckList isEdit={isEdit} setIsEdit={setIsEdit} />
</SafeAreaView>
)}
options={() => ({
animationTypeForReplace: 'pop',
animation: 'slide_from_bottom',
Expand Down
5 changes: 3 additions & 2 deletions screens/BasicCheckList/BasicInfoOfBasicCheckList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ import BottomSheetsOfDeletedCheckList from '../../components/CheckListComponent/
import { checkListTypes } from '../../types/checkListTypes';
import ButtonOfBringBackDeletedCheckList from '../../components/CheckListComponent/ButtonOfBringBackDeletedCheckList';
import axios from 'axios';
import { ActivityIndicator, View } from 'react-native';
import { ActivityIndicator, Dimensions, SafeAreaView, View } from 'react-native';
import { checkListCtx } from '../../Context/CheckListByServer';
import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
import CheckListSummaryComponenet from '../../components/CheckListComponent/CheckListSummaryComponenet';
import { useFocusEffect } from '@react-navigation/native';
import { useHeaderHeight } from '@react-navigation/elements';

interface IProps {
isEdit: boolean;
Expand Down Expand Up @@ -94,7 +95,7 @@ function BasicInfoOfBasicCheckList({ isEdit, setIsBottomSheet }: IProps) {
<View>
<BottomSheetModalProvider>
<KeyboardAwareScrollView extraHeight={150}>
<ScrollView contentContainerStyle={{ marginBottom: 80 }}>
<ScrollView>
<CheckListSummaryComponenet checkListSummary={checkListSummary} />
{checkLists
.filter((item) => item.visibility)
Expand Down
2 changes: 1 addition & 1 deletion screens/Landing/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const styles = StyleSheet.create({
borderRadius: 55,
position: 'absolute',
right: 20,
bottom: 50,
bottom: 70,
},

emoji: { lineHeight: 24, fontSize: 12 },
Expand Down

0 comments on commit cfc2bc5

Please sign in to comment.