레이아웃 연습 #1 > 앱개발

앱개발

레이아웃 연습 #1 정보

레이아웃 연습 #1

본문

https://g6ling.gitbooks.io/react-native-tutorial-korean/content/1-5ko.html 참조 

 

ff9cdf20f22e0f6aac1605ab7717088c_1479834414_7312.png

 

광고까지 하면 크게 5개로 나눠 집니다.

NavBar, User, ButtonGroup, Ads, Taps로..  가능하면 Fixed Height를 사용하지 말고, Flex를 사용해서 만들어 보세요..

 

*** 코드가 길어지니 에러가 나네요..  아래와 같이 만들어 봤습니다.

 

807e1408f3086de61be7726b302f5d2f_1479875168_5068.png

 

아래의 코드를 밑의 글의 링크에 카피 & 페이스트로 테스트 해 보세요

 


import React, { Component } from 'react';
import { Text, View, StyleSheet, AppRegistry } from 'react-native';
 
class NavBar extends Component {
  render() {
    return (
      <View style={styles.navbar}>
        <Text style={styles.textColor}>더보기</Text>
      </View>
    )
  }
}
class User extends Component {
  render() {
    return (
      <View style={styles.user}>
      </View>
    )
  }
}
class ButtonGroup extends Component {
  render() {
    return (
      <View style={styles.buttongroup}>
 
      </View>
    )
  }
}
class Ads extends Component {
  render() {
    return (
      <View style={styles.ads}>
      </View>
    )
  }
}
class Taps extends Component {
  render() {
    return (
      <View style={styles.taps}>
 
      </View>
    )
  }
}
 
class gitbookTest extends Component {
  render() {
    return (
      <View style={styles.container}>
        <NavBar />
        <User />
        <ButtonGroup />
        <Ads />
        <Taps />
 
      </View>
    );
  }
}
 
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'column',
    justifyContent: 'space-between'
  },
  navbar: {
    height: 50,
    marginTop: 20,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: 'orangered',
  },
  textColor: {
    color: 'white',
    fontSize: 20
  },
  user: {
    flex: 2,
    backgroundColor: 'darkturquoise'
  },
  buttongroup: {
    marginTop: 40,
    flex: 3,
    backgroundColor: 'lightgreen',
  },
  ads: {
    flex: 1,
    backgroundColor: 'mediumpurple',
  },
  taps: {
    flex: 1,
    backgroundColor: 'blue'
  },
  rightBottom: {
    flex: 2,
    backgroundColor: 'yellow'
  }
 
});
AppRegistry.registerComponent('awesome', () => gitbookTest);

 
공감
0

댓글 0개

전체 756 |RSS
앱개발 내용 검색

회원로그인

진행중 포인트경매

  1. 참여6 회 시작24.04.25 20:23 종료24.05.02 20:23
(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT