React-Native Tutorial To do list [ #5 ]

์กฐํŒ”๋กœยท2020๋…„ 9์›” 21์ผ
0

React-Native-Todolist

๋ชฉ๋ก ๋ณด๊ธฐ
5/15
post-thumbnail

React Native Tutorial ๋”ฐ๋ผํ•˜๊ธฐ ๐Ÿ“ฑ

๐Ÿ“Œ ํŠœํ† ๋ฆฌ์–ผ์„ ๋”ฐ๋ผํ•œ ํ”„๋กœ์ ํŠธ์ž…๋‹ˆ๋‹ค!

Scroll View ์ถ”๊ฐ€ํ•˜๊ธฐ

react-native ๋ชจ๋“ˆ๋กœ๋ถ€ํ„ฐ import ํ•ด์˜ค๊ธฐ

import {  ... ScrollView,} from 'react-native';

Scroll View ์ถ”๊ฐ€ํ•˜๊ธฐ

์•„๋ž˜์˜ ์ฝ”๋“œ๋ฅผ TextInput ๋‹ค์Œ์— ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

<ScrollView>
    <Text>TodoList</Text>
</ScrollView>

app.js ๋ณด๊ธฐ

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

app.js ์ „์ฒด๋ณด๊ธฐ

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

const App = () => {
  return (
    <SafeAreaView style={styles.container}>
      <Text style={styles.appTitle}>Hello Todo List</Text>
      <View style={styles.card}>
        <TextInput style={styles.input} placeholder="Add an item!" />
        <ScrollView>
          <Text>TodoList</Text>
        </ScrollView>
      </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,
    borderTopRightRadius: 10,
    marginLeft: 10,
    marginRight: 10,
  },
  input: {
    padding: 20,
    borderBottomColor: '#bbb',
    borderBottomWidth: 1,
    fontSize: 24,
    marginLeft: 20,
  }
});

export default App;

๊ฒฐ๊ณผ๋ณด๊ธฐ

profile
ํ˜„์‹ค์— ์•ˆ์ฃผํ•˜์ง€ ์•Š๊ณ  - ๊ฐœ๋ฐœ์ž

0๊ฐœ์˜ ๋Œ“๊ธ€