728x90
반응형

React Native 96

react-native 해더 중앙 정렬 및 버튼

static navigationOptions = { // 헤더의 오른쪽에 버튼 만들기 headerRight: () => ( alert('This is a button!')} title="Info" color="#fff" /> ), // 헤더의 왼쪽에 버튼 만들기 headerLeft: () => ( alert('This is a button!')} title="Info" color="#fff" /> ), // 헤더의 텍스트를 가운데로 정렬 headerTitleAlign: 'center', }; 또는 해더 자체에 컴포넌트를 넣을 수 있다 , static navigationOptions = { headerTitle: () => , }; class Title extends Component { render(){..

React Native 2020.01.27

React Native ToastAndroid

import React from 'react' //'react-native'에서 ToastAndroid 가져오기 import { View, Text, ToastAndroid } from 'react-native' let styles const Toast = () => { let { container, button} = styles // ToastAndroid.show()를 호출하는 basicToast 메서드 만들기 const basicToast = () => { ToastAndroid.show('Hello World!', ToastAndroid.LONG) } // ToastAndroid.showWithGravity()를 호출하는 gravityToast 메서드 만들기 const gravityToast = ..

React Native 2020.01.17

React native ViewPager 사용하기

이전 드로어 레이아웃 만들기에서 App.js 에 임폴트 해주고 case 추가 Menu.js 에 버튼 이벤트 추가 해준다 . import React, { Component } from 'react' // 'react-native'에서 ViewPagerAndroid 가져오기 import { View, Text } from 'react-native' import ViewPager from "@react-native-community/viewpager" import Home from './Home' import Toolbar from './Toolbar' class ViewPagerComponent extends Component { render () { const { pageStyle, page1Style, ..

React Native 2020.01.17

React Native에서 Android Drawer 레이아웃 사용

index.js import React,{Component} from 'react' import {AppRegistry,DrawerLayoutAndroid,Button,View, TouchableWithoutFeedbackBase} from 'react-native' import App from './app/App'; import Menu from './app/Menu'; import {name as appName} from './app.json'; /* 기본 페이지를 'Home'으로 만들어 놓은 드로어 레이아웃을 루트로 랜더링 한다. */ class mycomponent extends Component{ constructor(){ super() this.state = { scene : 'Home' } ..

React Native 2020.01.17
728x90
반응형