고요빛물결
앱개발

레이아웃 연습 #1

· 2016-11-23 (수) 02:11:10 · 1854

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

 

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

 

[code]

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);

[/code]
 

댓글을 작성하시려면 로그인이 필요합니다.

소모임

23,243건
+
분류 제목 글쓴이 날짜 조회
앱개발 16-11-24 조회 1,347
출산육아
[출산육아]
16-11-24 조회 1,018
앱개발 16-11-23 조회 1,319
해외사용자 16-11-23 조회 1,810
오늘뭐먹지?
[오늘뭐먹지?]
16-11-23 조회 2,503
정치/경제/사회
[정치/경제/사회]
16-11-23 조회 2,022
호스팅정보 16-11-23 조회 2,158
서버관리자 16-11-23 조회 3,573
해외사용자 16-11-23 조회 1,658
앱개발 16-11-23 조회 1,855
영화가좋다
[영화가좋다]
16-11-23 조회 3,360
해외사용자
[해외사용자]
16-11-23 조회 1,541
앱개발 16-11-23 조회 1,314
소지구 16-11-23 조회 2,149
출산육아 16-11-23 조회 1,159
모형취미 16-11-23 조회 930
소지구 16-11-22 조회 3,588
해외사용자
[해외사용자]
16-11-22 조회 1,690
서버관리자 16-11-22 조회 2,405
앱개발 16-11-22 조회 1,605
소지구 16-11-22 조회 2,044
앱개발 16-11-22 조회 1,444
앱개발 16-11-22 조회 1,782
해외사용자 16-11-22 조회 1,543
해외사용자
[해외사용자]
16-11-21 조회 1,616
출산육아
[출산육아]
16-11-21 조회 893
앱개발 16-11-21 조회 1,750
정치/경제/사회 16-11-21 조회 2,039
영화가좋다 16-11-21 조회 3,970
앱개발 16-11-21 조회 1,686