u_ju
우주의 우당탕탕개발일지
u_ju
전체 방문자
오늘
어제
  • 분류 전체보기 (118)
    • 팀 프로젝트 (2)
    • 내배캠 WIL & TIL (91)
    • JS (0)
    • React (1)
    • CS (23)
    • Next (1)

블로그 메뉴

  • 홈
  • 태그
  • 방명록

공지사항

인기 글

태그

  • 일요일 오늘은 내가 바로 함수만들기 요리사 !
  • Component를 처음 선언하는 것을 Mount 라고 한다던데...?#props #state
  • 코딩#바보#오류투성이#팀프로젝트
  • 회의감#현타#나름뿌듯#고민거리#코딩#IT#CSS#JS
  • 배열#함수

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
u_ju

우주의 우당탕탕개발일지

내배캠 WIL & TIL

TIL) 스파르타 개발일지 23-01-03

2023. 1. 4. 09:34

리액트 네이티브 공부

 

view box는 기본적으로 div이다.

flex direction은 기본이 컬럼이다. Top > bottom

문자열사용시 Text component 사용 필수

img tag의 경우 require 메소드 사용

<Image source={require("./이미지 경로")}/>
import { StatusBar } from 'expo-status-bar';
import {
  StyleSheet,
  Text,
  View,
  TouchableOpacity,
  SafeAreaView,
  ScrollView,
  TextInput,
} from "react-native";
import { AntDesign, FontAwesome } from "@expo/vector-icons";
import { useState } from "react";
export default function App() {
  //* Add Todo
  //* Input 창에서 엔터누르면 Todo 추가
  const [todos, setTodos] = useState([]);
  const [category, setCategory] = useState("js"); // js, react, ct
  const [text, setText] = useState("");

  const newTodo = {
    id: Date.now(),
    text,
    iosDone: false,
    isEdit: false,
    category,
  };
  const addTodo = () => {
    setTodos((prev) => [...prev, newTodo]);
  };
  return (
    <SafeAreaView>
      <View style={styles.container}>
        <View style={styles.buttonContainer}>
          <TouchableOpacity style={styles.button} title="Javascript">
            <Text style={styles.text}>Javascript</Text>
          </TouchableOpacity>
          <TouchableOpacity style={styles.button} title="React">
            <Text style={styles.text}>React</Text>
          </TouchableOpacity>
          <TouchableOpacity style={styles.button} title="Coding Test">
            <Text style={styles.text}>Coding Test</Text>
          </TouchableOpacity>
        </View>
        <View style={styles.inputContainer}>
          <TextInput style={styles.inputbox} placeholder="Enter your task" />
        </View>
        <View>
          <ScrollView>
            <View style={styles.todoListContainer}>
              <Text style={styles.todoTextBox}> React Native 공부하자! </Text>
              <View style={styles.iconContainer}>
                <AntDesign name="checksquareo" size={24} color="black" />
                <FontAwesome name="pencil-square-o" size={24} color="black" />
                <FontAwesome name="trash-o" size={24} color="black" />
              </View>
            </View>
          </ScrollView>
        </View>
      </View>
    </SafeAreaView>
  );
}
const styles = StyleSheet.create({
  container: {
    // flex: 1,
    backgroundColor: "#fff",
    padding: 20,
  },
  buttonContainer: {
    flexDirection: "row",
    justifyContent: "space-between",
    paddingBottom: 20,
    borderBottomColor: "black",
    borderBottomWidth: 1,
  },
  button: {
    backgroundColor: "#98EBFF",
    padding: 10,
    height: 50,
    width: 100,
    justifyContent: "center",
    alignItems: "center",
  },
  text: {
    color: "black",
    fontWeight: "bold",
  },
  inputContainer: {
    borderBottomColor: "black",
    borderBottomWidth: 1,
    marginBottom: 20,
  },
  inputbox: {
    marginVertical: 20,
    padding: 10,
    borderColor: "black",
    borderWidth: 1,
  },
  todoListContainer: {
    flexDirection: "row",
    backgroundColor: "#DADADA",
    padding: 10,
    width: 350,
    marginVertical: 5,
    justifyContent: "space-between",
    alignItems: "center",
  },
  iconContainer: {
    flexDirection: "row",
    width: 100,
    justifyContent: "space-around",
  },
});

todolist

'내배캠 WIL & TIL' 카테고리의 다른 글

TIL) 스파르타 개발일지 23-01-05  (0) 2023.01.06
TIL) 스파르타 개발일지 23-01-04  (0) 2023.01.05
TIL) 스파르타 개발일지 23-01-02  (0) 2023.01.03
★WIL) 스파르타 개발일지 23-01-01  (0) 2023.01.02
TIL) 스파르타 개발일지 22-12-30  (0) 2023.01.02
    '내배캠 WIL & TIL' 카테고리의 다른 글
    • TIL) 스파르타 개발일지 23-01-05
    • TIL) 스파르타 개발일지 23-01-04
    • TIL) 스파르타 개발일지 23-01-02
    • ★WIL) 스파르타 개발일지 23-01-01
    u_ju
    u_ju

    티스토리툴바