일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- Hook
- Kotlin
- RecyclerView
- TypeScript
- npm
- Java
- 구글맵스
- 코틀린
- SpringBoot
- fragment
- Android
- React
- 오버라이딩
- GoogleMaps
- 자바스크립트
- 리액트
- Linux
- nodejs
- TextView
- Javscript
- 안드로이드
- JS
- 랜덤번호
- array
- stylesheet
- 스프링부트
- JavaScript
- button
- 랜덤넘버
- scrollview
- Today
- Total
목록TypeScript (10)
타닥타닥 개발자의 일상
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bkUMk3/btrvUCtZWff/ftmKoCMoBqbbBiU0y7Sqk0/img.png)
builderX를 이용하면 별다른 코드를 작성하지 않고 쉽게 화면의 레이아웃을 만들수 있다. https://builderx.io/ BuilderX BuilderX is a browser based screen design tool that codes React Native & React for you builderx.io 구글 아이디만 있으면 편하게 사용 가능하다. new project를 클릭하면 새로운 레이아웃을 만들수 있다. Device로 OS를 설정하고 화면의 크기를 설정하는 기초 설정을 먼저해준다. 그다음 본인이 원하는 소스를 추가해 화면을 구성하면 된다. 코드를 보기 위해서는 우측 상단의 CODE를 클릭하면 된다. CODE를 클릭하면 Download Component 버튼이 보이는데 이를 클릭...
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/xjehw/btrvuQf1fyu/NYQYDxbmtz2H7AjP0bfFI0/img.jpg)
생성문 npx react-native init sample25 --template react-native-template-typescript 설치문 npm install react-native-gesture-handler npm install @react-navigation/native npm install @react-navigation/bottom-tabs npm install react-native-safe-area-context npm install react-native-screens npm install react-native-vector-icons npm install watcher npm i --save-dev @types/react-native-vector-icons 생성파일 src 폴더..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/HlinO/btrvvEe67vh/1LJykYgO9MulKgN4lahjkK/img.jpg)
생성문 npx react-native init sample24 --template react-native-template-typescript 생성파일 src 폴더 생성 > 그 안에 component 폴더 생성 > component폴더안에 CountProvider, First, Second, Third, TextProvider 타입 스크립트 파일 생성 TextProvider.tsx import React, { createContext } from "react"; import { Text } from "react-native"; export const TextContext = createContext({}) interface Props{ children: JSX.Element } export default ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/ypb4A/btrvrBb7Nj1/x2I9O51zm1UbBdVx3FkTH1/img.jpg)
실행구문 npx react-native init sample22 --template react-native-template-typescript App.tsx import React, { useMemo, useState } from "react"; import { Button, Text, View } from "react-native"; /* useMemo: 연산된 값을 렌더링시에 재사용할때 사용된다 useMeMo(func,검사할 배열 ) */ function square(params:any){ const testData = [Array(10).keys] testData.forEach(()=>{ console.log(`계산중.. 루프처리 ${testData.length}회 실행중..`) }) return ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/dw2L8J/btrvvuiXlll/Vx82e4gM0ftHYuk9uwVsNK/img.jpg)
실행문 npx react-native init sample21 --template react-native-template-typescript App.tsx import React, { useEffect, useState } from "react"; import { StyleSheet, Text, View } from "react-native"; export default function App(){ return( ) } const Clock =() =>{ const [date, setDate] = useState(()=> new Date()) useEffect(()=>{ const timeId = setInterval(()=>tick(),1000) console.log('setInteval') retur..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cD625H/btrvyibgKqP/qSSog4lEwwKEi6ArCGSzTk/img.jpg)
실행문 npx react-native init sample20 --template react-native-template-typescript App.tsx import React, { useEffect, useState } from "react"; import { Button, Text, View } from "react-native"; /* useEffect: 컴퍼넌트가 rendering 될때마다 특정 작업을 실행할 수 있도록 하는 hook compoentDidMount + componentDidUpdate + componentWillUnmount */ function Welcome(props:any) { console.log('start') useEffect(()=>{ //==$(document)...
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/zbCXy/btrvqkgbbYw/kaMq3rcdXN1QYziuWraOkK/img.jpg)
프로젝트 생성문 npx react-native init sample19 --template react-native-template-typescript src 폴더 생성 > components 폴더 생성 > Flexbox.tsx & Marginadding.tsx & WidthHeight.tsx 파일 생성 WidthHeight.tsx import React from "react"; import { StyleSheet, Text, View } from "react-native"; export const WidthHeight= () =>( 200X100 ) const style = StyleSheet.create({ container:{ width:200, height:100, borderWidth:StyleS..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/IL5fG/btrvhnLMcMI/PV0Ka4mAZfdvCkNi9cSJK1/img.jpg)
프로젝트 생성문 npx react-native init sample18 --template react-native-template-typescript App.tsx import React from "react"; import { StyleSheet, Text, View } from "react-native"; //flex : 크기 비율로 설정하는 것 export default function App(){ return ( 두번째 화면 ) } const style = StyleSheet.create({ container:{ flex:1, width:300 }, caseOne:{ flex:1, backgroundColor:'yellow' }, caseTwo:{ flex:1, backgroundColor:'bl..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/beC6cf/btrvoQzqVB6/9EiQ1wxXRx83zmKdlbvY10/img.jpg)
App.tsx import React, { useState } from "react"; import { Button, Text, TextInput, View } from "react-native"; let glTag:String //사용되지 않는 함수 function MyFunc(props:any){ console.log(props.name) props.setText('Money') return {props.name} } export default function App(){ const [ inputTextValue, setInputTextValue ] =useState("") const [text,setText] = useState("") //setInputTextValue에 text값을 입력하는 함수..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/cxGk8n/btruWjKBbQ4/92drMjPhMXDlkCmQBbD4lK/img.png)
npx react-native init (프로젝트명) --template react-native-template-typescript 위의 명령어로 구현된 프로젝트가 생성되면 좌측 콘솔에 cd 프로젝트명 npm start 우측 콘솔에 cd 프로젝트명 npm run android 입력하여 설정 완료하기 위에 명시된대로 순서대로 입력하면 콘솔창이 아래와 같아진다. 생성된 프로젝트 폴더에 있는 App.tsx 파일 열고 아래와 같이 입력한다음 저장해보자. import React from "react" import {SafeAreaView, Text} from "react-native" /* export default function App(){ //상수 const str:String = 'Hello World' ..