커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
세이프티 에어리어 및 버튼색이 달라요
[왕초보] 나만의 수익성 앱, 앱개발 종합반
2주차
북마크
안*혁
댓글
23
추천
0
조회수
14
조회수
14
답변 완료


저는 2주차에 버튼 코드니스펫복사하면 글씨색이아니고 글씨 바탕이바뀌는데 맞는건가요?


그리고 핸드폰이 z플립3인데 세이프티에어리어를해도 그대로네요 ㅠㅠ 오류는안나는데



보고 계신 화면 전체를 캡처해 주시면, 튜터님들이 빠르게 상황을 상황을 이해할 수 있어요.




작성한 코드 및 에러 메세지

import React from 'react';

import { StyleSheet, Text, View, Button, Alert } from 'react-native';


export default function App() {

 return (

  <View style={styles.container}>

   <View style={styles.textContainer}>

    <Text style={styles.textStyle}>아래 버튼을 눌러주세요</Text>

    {/* 버튼 onPress 속성에 일반 함수를 연결 할 수 있습니다. */}

    <Button 

     style={styles.buttonStyle} 

     title="버튼입니다 "

     color="#f194ff" 

     onPress={function(){

      Alert.alert('팝업 알람입니다!!')

     }}

    />

    {/* ES6 문법으로 배웠던 화살표 함수로 연결 할 수도 있습니다. */}

    <Button 

      style={styles.buttonStyle} 

      title="버튼입니다 "

      color="#FF0000" 

      onPress={()=>{

       Alert.alert('팝업 알람입니다!!')

      }}

     />

     </View>

  </View>

 );

}


const styles = StyleSheet.create({

 container: {

  flex: 1,

  backgroundColor: '#fff',

 },

 textContainer: {

  height:100,

  margin:10,

 },

 textStyle: {

  textAlign:"center"

 },

});



세이프티에어리어


import React from 'react';

import { StyleSheet, Text, View, Button, Alert, SafeAreaView } from 'react-native';


export default function App() {

  return (

    <SafeAreaView style={styles.container}>

      <View style={styles.textContainer}>

        <Text style={styles.textStyle}>아래 버튼을 눌러주세요</Text>

        {/* 버튼 onPress 속성에 일반 함수를 연결 할 수 있습니다. */}

        <Button

          style={styles.buttonStyle}

          title="버튼입니다 "

          color="#f194ff"

          onPress={function(){

            Alert.alert('팝업 알람입니다!!')

          }}

        />

        {/* ES6 문법으로 배웠던 화살표 함수로 연결 할 수도 있습니다. */}

        <Button

            style={styles.buttonStyle}

            title="버튼입니다 "

            color="#FF0000"

            onPress={()=>{

              Alert.alert('팝업 알람입니다!!')

            }}

          />

          </View>

    </SafeAreaView>

  );

}


const styles = StyleSheet.create({

  container: {

    flex: 1,

    backgroundColor: '#fff',

  },

  textContainer: {

    height:100,

    margin:10,

  },

  textStyle: {

    textAlign:"center"

  },

});

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