View, Text_ReactNative

miin·2023년 5월 18일
0

ReactNative

목록 보기
1/10
post-thumbnail

react native는 웹이 아니기 때문에 div는 사용 할 수 없다

  • StatusBar
    import {StatusBar } from 'expo-status-bar'로 임포트해서 사용 할 수 있다
    모바일 상단의 시계, 배터리, 와이파이를 의미한다

StyleSheet 예시

  • const styles = StryleSheet.create({})
  • 웹에서 하던 메소드가 없을 수 있다
  • 예시1
<View style={styles.container}>
  const styles = StyleSheet.create({
  container: {
    marginTop: 50,
  },
  bigBlue: {
    color: 'blue',
    fontWeight: 'bold',
    fontSize: 30,
  },
  red: {
    color: 'red',
  },
});
  • 예시2(인라인으로 작성 가능)
	<View
        style={{
          width: 50,
          height: 50,
          backgroundColor: 'powderblue',
        }}
      />
  • 예시3(자동완성이 되지 않음)
const styles = {
  text:{
    width: 50,
          height: 50,
          backgroundColor: 'powderblue'
  }
}

import { StyleSheet, Text, View } = 'react-native'로 사용하게 된다

0개의 댓글