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

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

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


선생님과 동일하게 SafeAreaView 입력했는데 적용이 되지않고 상단 바에 걸리는 이유가 무엇일까요ㅠ



스파르타 즉문즉답




작성한 코드 및 에러 메세지

import React from 'react';

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


export default function App() {

const customerAlert = () => {

  Alert.alert("JSX 밖에서 함수 구현 가능!")

}

  return (

    <SafeAreaView style={styles.container}>

      <View style={styles.textContainer}>

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

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

        <Button

          style={styles.buttonStyle}

          title="!!!!! "

          color="#f194ff"

          onPress={customerAlert}

        />

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

        <Button

            style={styles.buttonStyle}

            title="버튼입니다 "

            color="#FF0000"

            onPress={() => {customerAlert()}}

          />

          </View>

    </SafeAreaView>

  );

}


const styles = StyleSheet.create({

  container: {

    flex: 1,

    backgroundColor: '#fff',

  },

  textContainer: {

    height:100,

    margin:10,

  },

  textStyle: {

    textAlign:"center"

  },

});

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