안녕하세요.
2-4에서 버튼소스를 붙여넣기하면 '아래 버튼을 눌러주세요'가 위 상단바에 있어서 안보이니까
SafeAreaView 태그를 쓰라고해서 동일하게 적용했는데요.
저는 갤럭시 S22 사용중인데 최상단 바에 똑같이 나와서요
시간있는 상태바 밑에 떠야하는게 아닌가 싶은데 휴대폰 기종에 따라 다르게 보이는 걸까요?
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"
},
});