Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 스프링부트
- GoogleMaps
- 구글맵스
- 랜덤넘버
- Javscript
- Kotlin
- Linux
- React
- npm
- stylesheet
- 자바스크립트
- TextView
- 오버라이딩
- nodejs
- 랜덤번호
- button
- 리액트
- SpringBoot
- TypeScript
- array
- RecyclerView
- scrollview
- Hook
- 코틀린
- fragment
- JavaScript
- JS
- 안드로이드
- Java
- Android
Archives
- Today
- Total
타닥타닥 개발자의 일상
react 이미지 화면에 구현하기 (파일 불러와서 구현하기 / 이미지 주소로 구현하기) / 글자 자간, 글자 배경색 지정하기 / 텍스트 영역에 테두리 만들기 / imageview / text StyleSheet 모음 본문
코딩 기록/react
react 이미지 화면에 구현하기 (파일 불러와서 구현하기 / 이미지 주소로 구현하기) / 글자 자간, 글자 배경색 지정하기 / 텍스트 영역에 테두리 만들기 / imageview / text StyleSheet 모음
NomadHaven 2022. 3. 7. 18:15프로젝트 생성문
npx react-native init sample17 --template react-native-template-typescript
구현할 이미지는 scr>assets폴더에 저장해둔다.
ship.jpg 파일을 저장해두었다.
App.tsx
import React from "react";
import { Image, SafeAreaView, StyleSheet, Text, View } from "react-native";
export default function App(){
return(
<View>
<Image
source={{uri:'https://reactnative.dev/docs/assets/favicon.png'}}
style={{width:100, height:100, resizeMode:'contain', opacity:0.5}}
/>
<Image
source={require('./src/assets/ship.jpg')}
style={{width:300, height:300}} />
</View>
)
}
실행화면
글자 배경색, 글자 위치 지정하기
App.tsx
import React from "react";
import { Image, SafeAreaView, StyleSheet, Text, View } from "react-native";
export default function App(){
return(
<View>
<Text style={{backgroundColor:"#ffff00", textAlign:"center"}}>Hello</Text>
<Text style={{textAlign:"right"}}>World</Text>
</View>
)
}
const style = StyleSheet.create({
hello:{
backgroundColor:"#ff0000"
}
})
글자 자간 지정하기
App.tsx
import React from "react";
import { Image, SafeAreaView, StyleSheet, Text, View } from "react-native";
export default function App(){
return(
<View>
<Text style={{letterSpacing:2, fontSize:18}}>
오는 9일 진행되는 20대 대선 본투표에서 코로나19 확진자와 격리자들은 일반 유권자와 같은 방법으로 직접 투표함에 용지를 넣는 방식으로 투표를 하게 된다.
</Text>
</View>
)
}
실행화면
텍스트 영역에 테두리 만들기
App.tsx
import React from "react";
import { Image, SafeAreaView, StyleSheet, Text, View } from "react-native";
export default function App(){
return(
<View style={style.world}>
<Text>Hello</Text>
<Text>World</Text>
</View>
)
}
const style = StyleSheet.create({
world:{
borderWidth:1,
bordercolor:'gray',
borderBottomLeftRadius:10,
borderTopRightRadius:10
}
})
실행화면
'코딩 기록 > react' 카테고리의 다른 글
react / flex 속성 이용하여 화면 비율 조정하기 (typescript) (0) | 2022.03.07 |
---|---|
react / 색상코드와 방향 조절로 화면에 색상카드 만들기 / SafeAreaView / transform : rotateX, rotateZ (0) | 2022.03.07 |
react / checkbox 만들고 check된 화면에 상태 확인, 출력하기 (typescript, Checkbox, Button) (0) | 2022.03.07 |
react radio버튼 이용하여 값 선택하기 radiogroup radiobutton (0) | 2022.03.07 |
react picker select, selectbox watcher 이용하여 다양한 데이터 선택하기 (0) | 2022.03.07 |
Comments