React-Native Tutorial To do list [ #4 ]

μ‘°νŒ”λ‘œΒ·2020λ…„ 9μ›” 21일
0

React-Native-Todolist

λͺ©λ‘ 보기
4/15
post-thumbnail

React Native Tutorial λ”°λΌν•˜κΈ° πŸ“±

πŸ“Œ νŠœν† λ¦¬μ–Όμ„ λ”°λΌν•œ ν”„λ‘œμ νŠΈμž…λ‹ˆλ‹€!

Card View μΆ”κ°€ν•˜κΈ°

View μΆ”κ°€ν•˜κΈ°

μ•„λž˜μ˜ μ½”λ“œλ₯Ό μ•± 타이틀 λ°”λ‘œ μ•„λž˜μ— μΆ”κ°€ν•©λ‹ˆλ‹€!

<View style={styles.card}>
  <TextInput style={styles.input} placeholder="Add an item!" />
</View>

app.js 보기

import React from 'react';
import {SafeAreaView, StyleSheet, TextInput, View, Text} from 'react-native';

const App = () => {
  return (
    <SafeAreaView style={styles.container}>
      <Text style={styles.appTitle}>Hello Todolist</Text>
      <View style={styles.card}>
        <TextInput style={styles.input} placeholder="Add an item!" />
      </View>
    </SafeAreaView>
  );
};

style μΆ”κ°€ν•˜κΈ°

  card: {
    backgroundColor: '#fff',
    flex: 1,
    borderTopLeftRadius: 10, // to provide rounded corners
    borderTopRightRadius: 10, // to provide rounded corners
    marginLeft: 10,
    marginRight: 10,
  },
  input: {
    padding: 20,
    borderBottomColor: '#bbb',
    borderBottomWidth: 1,
    fontSize: 24,
    marginLeft: 20,
  },
});

app.js 전체보기

import React from 'react';
import {SafeAreaView, StyleSheet, TextInput, View, Text} from 'react-native';

const App = () => {
  return (
    <SafeAreaView style={styles.container}>
      <Text style={styles.appTitle}>Hello Todolist</Text>
      <View style={styles.card}>
        <TextInput style={styles.input} placeholder="Add an item!" />
      </View>
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#3143e8',
  },
  appTitle: {
    color: '#fff',
    fontSize: 36,
    marginTop: 30,
    marginBottom: 30,
    fontWeight: '300',
    textAlign: 'center',
    backgroundColor: '#3143e8',
  },
  card: {
    backgroundColor: '#fff',
    flex: 1,
    borderTopLeftRadius: 10, // to provide rounded corners
    borderTopRightRadius: 10, // to provide rounded corners
    marginLeft: 10,
    marginRight: 10,
  },
  input: {
    padding: 20,
    borderBottomColor: '#bbb',
    borderBottomWidth: 1,
    fontSize: 24,
    marginLeft: 20,
  },
});

export default App;

κ²°κ³Ό


μ£Όμ˜μ‚¬ν•­

View, Text 같은 react-native 속성을 import ν•΄μ•Όν•œλ‹€. μ•ˆν•˜λ©΄ μ—λŸ¬λ‚¨

import {SafeAreaView, StyleSheet, Text} from 'react-native';

profile
ν˜„μ‹€μ— μ•ˆμ£Όν•˜μ§€ μ•Šκ³  - 개발자

0개의 λŒ“κΈ€