Skip to content

Commit

Permalink
Merge pull request #13 from kusitms-28th-kukathon/feat/#8/star
Browse files Browse the repository at this point in the history
Feat/#8/star
  • Loading branch information
hoyyChoi authored Oct 7, 2023
2 parents 978d484 + 92c5ffc commit 88faef4
Show file tree
Hide file tree
Showing 5 changed files with 230 additions and 59 deletions.
11 changes: 6 additions & 5 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
};
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['react-native-reanimated/plugin'],
};
};
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@
"web": "expo start --web"
},
"dependencies": {
"@gorhom/bottom-sheet": "^4",
"@react-native-seoul/kakao-login": "^5.3.0",
"@react-navigation/bottom-tabs": "^6.5.9",
"@react-navigation/material-top-tabs": "^6.6.4",
"@react-navigation/native": "^6.1.8",
"@react-navigation/native-stack": "^6.9.14",
"@react-navigation/stack": "^6.3.18",
"date-fns": "^2.30.0",
"axios": "^1.5.1",
"date-fns": "^2.30.0",
"expo": "~49.0.13",
"expo-status-bar": "~1.6.0",
"react": "18.2.0",
Expand All @@ -25,10 +26,12 @@
"react-native-gesture-handler": "~2.12.0",
"react-native-modal": "^13.0.1",
"react-native-pager-view": "6.2.0",
"react-native-reanimated": "~3.3.0",
"react-native-safe-area-context": "^4.7.2",
"react-native-screens": "^3.25.0",
"react-native-tab-view": "^3.5.2",
"react-native-webview": "^13.6.2"
"react-native-webview": "^13.6.2",
"reanimated-bottom-sheet": "^1.0.0-alpha.22"
},
"devDependencies": {
"@babel/core": "^7.20.0"
Expand Down
34 changes: 23 additions & 11 deletions screens/SocialWebviewModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import axios from 'axios';

import {useNavigation} from '@react-navigation/native';
const REST_API_KEY = '8f9849291f535bb2078554c4085202fc';
const REDIRECT_URI = 'http://localhost:8081/auth/kakao/callback';
const REDIRECT_URI = 'http://3.37.52.73:80';

const runFirst = `window.ReactNativeWebView.postMessage("this is message from web");`;
const Axios = axios.create({
baseURL: 'http://3.37.52.73:80',
});

function SocialWebviewModal({setModalOpen}) {
const navigation = useNavigation();
Expand Down Expand Up @@ -49,16 +52,25 @@ function SocialWebviewModal({setModalOpen}) {

code: request_code,
},
})
.then(function (response) {
returnValue = response.data.access_token;
console.log(returnValue);
setModalOpen(false);
navigation.navigate('Home', {screen: 'Home'});
})
.catch(function (error) {
console.log('error', error);
});
}).then(function (response) {
returnValue = response.data.access_token;
console.log(returnValue);
axios
.post(
'http://3.37.52.73:80/api/user/auth/kakao-login',
{},
{
headers: {
'Content-type': 'application/x-www-form-urlencoded;charset=utf-8',
access: `Bearer ${returnValue}`,
},
},
)
.then(res => {
console.log(res.data);
navigation.navigate('Home', {screen: 'Home'});
});
});
};

return (
Expand Down
196 changes: 157 additions & 39 deletions screens/home.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,164 @@
import React from "react";
import { View, Text, StyleSheet, TouchableOpacity } from "react-native";
import { useNavigation } from "@react-navigation/native";
import { SafeAreaView } from "react-native-safe-area-context";

import React, {useCallback, useState, useMemo, useRef} from 'react';
import {
View,
SafeAreaView,
ScrollView,
Text,
StyleSheet,
TextInput,
TouchableOpacity,
} from 'react-native';
import BottomSheet from '@gorhom/bottom-sheet';

const Home = () => {
const navigation = useNavigation();

return (
<SafeAreaView style={Styles.container}>
<Text style={Styles.HomeText}>홈 화면</Text>
<TouchableOpacity
onPress={() => navigation.navigate("Splash", { screen: "Splash" })}
style={Styles.NextBottom}
>
<Text style={Styles.BottomText}>스플래시 화면으로</Text>
</TouchableOpacity>
</SafeAreaView>
);
const bottomSheetRef = useRef(null);

// variables
const snapPoints = useMemo(() => ['50%', '14%'], []);

// callbacks
const handleSheetChanges = useCallback(index => {
console.log('handleSheetChanges', index);
}, []);

const addList = value => {
setTextArray([...textArray, value]);
};

const [textArray, setTextArray] = useState([]);
const [value, onChangeText] = useState('');

return (
<SafeAreaView style={styles.container}>
<BottomSheet
ref={bottomSheetRef}
index={1}
snapPoints={snapPoints}
onChange={handleSheetChanges}
backgroundStyle={styles.BottomSheetContainer}
>
<View style={styles.contentContainer}>
<View style={styles.mainTitle}>
<Text style={styles.textTitle}>
오늘 하루 감사했던 일은 무엇인가요?
</Text>
<View style={styles.PlusTitle}>
<TouchableOpacity onPress={() => addList('')}>
<Text style={styles.TextPlus}>+</Text>
</TouchableOpacity>
</View>
</View>

<View style={styles.scrollView}>
{textArray.map((item, idx) => (
<TextInput
key={idx}
editable
multiline
placeholder="글을 작성해주세요!"
autoFocus
numberOfLines={4}
maxLength={40}
onChangeText={text => onChangeText(text)}
value={value}
style={styles.inputTag}
/>
))}
</View>
<View style={styles.registrationBtn}>
<TouchableOpacity onPress={() => registrationBtn()}>
<Text style={styles.TextRegister}>등록하기</Text>
</TouchableOpacity>
</View>
</View>
</BottomSheet>
</SafeAreaView>
);

};

export default Home;

const Styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
HomeText: {
fontSize: 30,
textAlign: "center",
},
NextBottom: {
backgroundColor: "purple",
padding: 10,
marginTop: "20%",
width: "50%",
alignSelf: "center",
borderRadius: 10,
},
BottomText: {
fontSize: 15,
color: "white",
textAlign: "center",
},
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#100D30',
},
contentContainer: {
flex: 1,
padding: 20,

// width: 390,
// position: 'relative',
// display: 'flex',
// marginTop: 50,
// justifyContent: 'center',
},
scrollView: {
height: 700,
width: '100%',
flex: 1,
flexDirection: 'coulmn',
},
BottomSheetContainer: {
opacity: 0.8,
borderRadius: 20,
},
mainTitle: {
display: 'flex',
flexDirection: 'row',
justifyContent: 'space-between',
alignItems: 'center',
},
textTitle: {
fontStyle: 'normal',
fontSize: 16,
fontWeight: 'bold',
color: '#24292F',
},
PlusTitle: {
backgroundColor: '#ffffff',
width: 32,
height: 32,
borderRadius: 500,
position: 'relative',
},
TextPlus: {
textAlign: 'center',
position: 'absolute',
top: -3,
left: 7,
fontSize: 30,
},
inputTag: {
marginTop: 20,
height: 50,
width: 350,
borderRadius: 100,
padding: 10,
backgroundColor: '#ffffff',
verticalAlign: 'middle',
lineHeight: 20,
paddingTop: 15,
paddingLeft: 25,
},
registrationBtn: {
position: 'absolute',
left: 20,
top: 250,
borderRadius: 8,
// bottom: 0,
width: 350,
height: 40,
backgroundColor: '#7149E0',
},
TextRegister: {
textAlign: 'center',
color: '#ffffff',
fontSize: 15,
fontWeight: 'bold',
lineHeight: 40,
},

});
41 changes: 39 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,13 @@
"@babel/helper-plugin-utils" "^7.22.5"
"@babel/plugin-syntax-numeric-separator" "^7.10.4"

"@babel/plugin-transform-object-assign@^7.16.7":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-assign/-/plugin-transform-object-assign-7.22.5.tgz#290c1b9555dcea48bb2c29ad94237777600d04f9"
integrity sha512-iDhx9ARkXq4vhZ2CYOSnQXkmxkDgosLi3J8Z17mKz7LyzthtkdVchLD7WZ3aXeCuvJDOW3+1I5TpJmwIbF9MKQ==
dependencies:
"@babel/helper-plugin-utils" "^7.22.5"

"@babel/plugin-transform-object-rest-spread@^7.22.15":
version "7.22.15"
resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-rest-spread/-/plugin-transform-object-rest-spread-7.22.15.tgz#21a95db166be59b91cde48775310c0df6e1da56f"
Expand Down Expand Up @@ -1095,7 +1102,7 @@
"@babel/types" "^7.4.4"
esutils "^2.0.2"

"@babel/preset-typescript@^7.13.0":
"@babel/preset-typescript@^7.13.0", "@babel/preset-typescript@^7.16.7":
version "7.23.0"
resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.23.0.tgz#cc6602d13e7e5b2087c811912b87cf937a9129d9"
integrity sha512-6P6VVa/NM/VlAYj5s2Aq/gdVg8FSENCg3wlZ6Qau9AcPaoF5LbN1nyGlR9DTRIw9PpxI94e+ReydsJHcjwAweg==
Expand Down Expand Up @@ -1496,6 +1503,21 @@
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==

"@gorhom/bottom-sheet@^4":
version "4.5.1"
resolved "https://registry.yarnpkg.com/@gorhom/bottom-sheet/-/bottom-sheet-4.5.1.tgz#1ac4b234a80e7dff263f0b7ac207f92e41562849"
integrity sha512-4Qy6hzvN32fXu2hDxDXOIS0IBGBT6huST7J7+K1V5bXemZ08KIx5ZffyLgwhCUl+CnyeG2KG6tqk6iYLkIwi7Q==
dependencies:
"@gorhom/portal" "1.0.14"
invariant "^2.2.4"

"@gorhom/[email protected]":
version "1.0.14"
resolved "https://registry.yarnpkg.com/@gorhom/portal/-/portal-1.0.14.tgz#1953edb76aaba80fb24021dc774550194a18e111"
integrity sha512-MXyL4xvCjmgaORr/rtryDNFy3kU4qUbKlwtQqqsygd0xX3mhKjOLn6mQK8wfu0RkoE0pBE0nAasRoHua+/QZ7A==
dependencies:
nanoid "^3.3.1"

"@graphql-typed-document-node/core@^3.1.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.2.0.tgz#5f3d96ec6b2354ad6d8a28bf216a1d97b5426861"
Expand Down Expand Up @@ -4847,7 +4869,7 @@ mz@^2.7.0:
object-assign "^4.0.1"
thenify-all "^1.0.0"

nanoid@^3.1.23, nanoid@^3.3.6:
nanoid@^3.1.23, nanoid@^3.3.1, nanoid@^3.3.6:
version "3.3.6"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.6.tgz#443380c856d6e9f9824267d960b4236ad583ea4c"
integrity sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==
Expand Down Expand Up @@ -5469,6 +5491,16 @@ [email protected]:
resolved "https://registry.yarnpkg.com/react-native-pager-view/-/react-native-pager-view-6.2.0.tgz#51380d93fbe47f6380dc71d613a787bf27a4ca37"
integrity sha512-pf9OnL/Tkr+5s4Gjmsn7xh91PtJLDa6qxYa/bmtUhd/+s4cQdWQ8DIFoOFghwZIHHHwVdWtoXkp6HtpjN+r20g==

react-native-reanimated@~3.3.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.3.0.tgz#80f9d58e28fddf62fe4c1bc792337b8ab57936ab"
integrity sha512-LzfpPZ1qXBGy5BcUHqw3pBC0qSd22qXS3t8hWSbozXNrBkzMhhOrcILE/nEg/PHpNNp1xvGOW8NwpAMF006roQ==
dependencies:
"@babel/plugin-transform-object-assign" "^7.16.7"
"@babel/preset-typescript" "^7.16.7"
convert-source-map "^2.0.0"
invariant "^2.2.4"

react-native-safe-area-context@^4.7.2:
version "4.7.2"
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.7.2.tgz#1673aa99b6a9235e7faaf5a248e69795d6e54e07"
Expand Down Expand Up @@ -5591,6 +5623,11 @@ readline@^1.3.0:
resolved "https://registry.yarnpkg.com/readline/-/readline-1.3.0.tgz#c580d77ef2cfc8752b132498060dc9793a7ac01c"
integrity sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg==

reanimated-bottom-sheet@^1.0.0-alpha.22:
version "1.0.0-alpha.22"
resolved "https://registry.yarnpkg.com/reanimated-bottom-sheet/-/reanimated-bottom-sheet-1.0.0-alpha.22.tgz#01a200946f1a461f01f1e773e5b4961c2df2e53b"
integrity sha512-NxecCn+2iA4YzkFuRK5/b86GHHS2OhZ9VRgiM4q18AC20YE/psRilqxzXCKBEvkOjP5AaAvY0yfE7EkEFBjTvw==

recast@^0.21.0:
version "0.21.5"
resolved "https://registry.yarnpkg.com/recast/-/recast-0.21.5.tgz#e8cd22bb51bcd6130e54f87955d33a2b2e57b495"
Expand Down

0 comments on commit 88faef4

Please sign in to comment.