커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
2주차 숙제 오류
[왕초보] 나만의 수익성 앱, 앱개발 종합반 v3
2주차
북마크
이*진
댓글
5
추천
0
조회수
15
조회수
15
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


어제 저녁에 숙제를 했는데 어제는 오류는 없고 오늘은 오류가 났습니다..expo go 앱 도 같은 오류 납니다!강의 안도 다시 찾아보고 숙제 중 숙제 풀이 영상도 찾아보고 강의 노션 도 찾아 봤지만

결국 오류가 났습니다 ㅠㅠ 도와주세요!

<오류 난 부분>

Android Bundling failed 1916ms

SyntaxError: C:\Users\user\Desktop\sparta-study\sparta-myhoneytip-jin\pages\AboutPage.js: Identifier 'AboutPage' has already been declared. (5:24)


 3 | import AboutPage from './pages/AboutPage';

 4 |

> 5 | export default function AboutPage(){

  |             ^

 6 |   const aboutImage = "https://storage.googleapis.com/sparta-image.appspot.com/lecture/about.png"

 7 |  return (

 8 |   <View style={styles.container}>


<about page 코딩>

import React from 'react'

import MainPage from './pages/MainPage';

import AboutPage from './pages/AboutPage';


export default function AboutPage(){

  const aboutImage = "https://storage.googleapis.com/sparta-image.appspot.com/lecture/about.png"

 return (

  <View style={styles.container}>

    <Text style={styles.title}>HI! 스파르타코딩 앱개발 반에 오신것을 환영합니다</Text>

    

    

    <View style={styles.textContainer}>

      <Image style={styles.aboutImage} source={{uri:aboutImage}} resizeMode={"cover"}/>

      <Text style={styles.desc01}>많은 내용을 간결하게 담아내려 노력했습니다!</Text>

      <Text style={styles.desc02}>꼭 완주 하셔서 꼭 여러분것으로 만들어가시길 바랍니다</Text>

      <TouchableOpacity style={styles.button}>

        <Text style={styles.buttonText}>여러분의 인스타계정</Text>

      </TouchableOpacity>

    </View>

  </View>)

}


const styles = StyleSheet.create({

  container: {

    flex:1,

    backgroundColor:"#1F266A",

    alignItems:"center"

   

  },

  title: {

    fontSize:30,

    fontWeight:"700",

    color:"#fff",

    paddingLeft:30,

    paddingTop:100,

    paddingRight:30

  },

  textContainer: {

    width:300,

    height:500,

    backgroundColor:"#fff",

    marginTop:50,

    borderRadius:30,

    justifyContent:"center",

    alignItems:"center"

  },

  aboutImage:{

    width:150,

    height:150,

    borderRadius:30

  },

  desc01: {

    textAlign:"center",

    fontSize:20,

    fontWeight:"700",

    paddingLeft:22,

    paddingRight:22


  },

  desc02: {

    textAlign:"center",

    fontSize:15,

    fontWeight:"700",

    padding:22

  },

  button:{

    backgroundColor:"orange",

    padding:20,

    borderRadius:15

  },

  buttonText: {

    color:"#fff",

    fontSize:15,

    fontWeight:"700"

  }

})

<main page 코딩>

import React from 'react';

import { StyleSheet, Text, View, Image, TouchableOpacity, ScrollView} from 'react-native';


const main = 'https://firebasestorage.googleapis.com/v0/b/sparta-image.appspot.com/o/lecture%2Fmain.png?alt=media&token=8e5eb78d-19ee-4359-9209-347d125b322c'

import data from '../data.json';


export default function MainPage() {

 let tip = data.tip;

 let todayWeather = 10 + 17;

 let todayCondition = "흐림"

 //return 구문 밖에서는 슬래시 두개 방식으로 주석

 return (

 /*

  return 구문 안에서는 {슬래시 + * 방식으로 주석

 */

 <ScrollView style={styles.container}>

  <Text style={styles.title}>나만의 꿀팁</Text>

  <Text style={styles.weather}>오늘의 날씨: {todayWeather + '°C ' + todayCondition} </Text>

  <Image style={styles.mainImage} source={{uri:main}}/>

  <ScrollView style={styles.middleContainer} horizontal indicatorStyle={"white"}>

  <TouchableOpacity style={styles.middleButton01}><Text style={styles.middleButtonText}>생활</Text></TouchableOpacity>

  <TouchableOpacity style={styles.middleButton02}><Text style={styles.middleButtonText}>재테크</Text></TouchableOpacity>

  <TouchableOpacity style={styles.middleButton03}><Text style={styles.middleButtonText}>반려견</Text></TouchableOpacity>

  <TouchableOpacity style={styles.middleButton04}><Text style={styles.middleButtonText}>꿀팁 찜</Text></TouchableOpacity>

  </ScrollView>

  <View style={styles.cardContainer}>

  {/* 하나의 카드 영역을 나타내는 View */}

  {

   tip.map((content,i)=>{

   return (<View style={styles.card} key={i}>

    <Image style={styles.cardImage} source={{uri:content.image}}/>

    <View style={styles.cardText}>

    <Text style={styles.cardTitle} numberOfLines={1}>{content.title}</Text>

    <Text style={styles.cardDesc} numberOfLines={3}>{content.desc}</Text>

    <Text style={styles.cardDate}>{content.date}</Text>

    </View>

   </View>)

   })

   }

   

  </View>

 

 </ScrollView>

 );

}


const styles = StyleSheet.create({

 container: {

 //앱의 배경 색

 backgroundColor: '#fff',

 },

 title: {

 //폰트 사이즈

 fontSize: 20,

 //폰트 두께

 fontWeight: '700',

 //위 공간으로 부터 이격

 marginTop:50,

 //왼쪽 공간으로 부터 이격

 marginLeft:20

 },

 weather:{

 alignSelf:"flex-end",

 paddingRight:20

 },

 mainImage: {

 //컨텐츠의 넓이 값

 width:'90%',

 //컨텐츠의 높이 값

 height:200,

 //컨텐츠의 모서리 구부리기

 borderRadius:10,

 marginTop:20,

 //컨텐츠 자체가 앱에서 어떤 곳에 위치시킬지 결정(정렬기능)

 //각 속성의 값들은 공식문서에 고대로~ 나와 있음

 alignSelf:"center"

 },

 middleContainer:{

 marginTop:20,

 marginLeft:10,

 height:60

 },

 middleButton01: {

 width:100,

 height:50,

 padding:15,

 backgroundColor:"#fdc453",

 borderColor:"deeppink",

 borderRadius:15,

 margin:7

 },

 middleButton02: {

 width:100,

 height:50,

 padding:15,

 backgroundColor:"#fe8d6f",

 borderRadius:15,

 margin:7

 },

 middleButton03: {

 width:100,

 height:50,

 padding:15,

 backgroundColor:"#9adbc5",

 borderRadius:15,

 margin:7

 },

 middleButtonText: {

 color:"#fff",

 fontWeight:"700",

 //텍스트의 현재 위치에서의 정렬

 textAlign:"center"

 },

 middleButton04: {

 width:100,

 height:50,

 padding:15,

 backgroundColor:"#f886a8",

 borderRadius:15,

 margin:7

 },

 cardContainer: {

 marginTop:10,

 marginLeft:10

 },

 card:{

 flex:1,

 //컨텐츠들을 가로로 나열

 //세로로 나열은 column <- 디폴트 값임

 flexDirection:"row",

 margin:10,

 borderBottomWidth:0.5,

 borderBottomColor:"#eee",

 paddingBottom:10


 },

 cardImage: {

 flex:1,

 width:100,

 height:100,

 borderRadius:10,

 },

 cardText: {

 flex:2,

 flexDirection:"column",

 marginLeft:10,

 },

 cardTitle: {

 fontSize:20,

 fontWeight:"700"

 },

 cardDesc: {

 fontSize:15

 },

 cardDate: {

 fontSize:10,

 color:"#A6A6A6",

 },



});

<app.js 코딩>

import React from 'react'

import MainPage from './pages/MainPage';

import AboutPage from './pages/AboutPage';



export default function App(){

 // return (<MainPage/>)

 return (<AboutPage/>)

}






취소
 공유
취소
댓글 0
댓글 알림
나의얼굴