일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
29 | 30 |
Tags
- react native
- 싸이월드
- 스탠실 버퍼 튜토리얼
- 리액트 네이티브 맥
- 스탠실 버퍼 시작
- node
- react
- react native mac
- react native typescript
- html
- node.js
- cyworld
- Expo
- 리액트 네이티브 설치 오류
- 스탠실 버퍼 사용
- GitHub
- 벡터와 리스트의 차이
- react native accessible
- C++
- react native typescript navigation
- react-native
- c++ using
- react native 타입스크립트
- react native ios 기기 연결
- unity stencil buffer
- c++ 정보은닉
- javascript
- react native typescript navigate
- stencil buffer
- CSS
Archives
- Today
- Total
혀니의 이거저거 뿌시기
react native 기본 코드 바탕으로 스크롤뷰 초안 만들기 본문
728x90
import React from 'react';
import type {PropsWithChildren} from 'react';
import {
SafeAreaView,
ScrollView,
StatusBar,
StyleSheet,
Text,
View
} from 'react-native';
type SectionProps = PropsWithChildren<{
title: string;
}>;
function Section({children, title}: SectionProps): JSX.Element {
return (
<View style={styles.sectionContainer}>
<Text
style={[styles.sectionTitle,{color: 'black'}]}>
{title}
</Text>
<Text style={[styles.sectionDescription,{color: 'black'}]}>
{children}
</Text>
</View>
);
}
function App(): JSX.Element {
const backgroundStyle = {
backgroundColor: 'darkgray',
flex: 1 //전체 스크롤뷰로 하나의 배경을 이루기 위함(이거 없으면 스크롤 아래는 흰색으로 나옴)
};
return (
<SafeAreaView style={backgroundStyle}>
<StatusBar
barStyle='dark-content'
/>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={backgroundStyle}>
<View style={{ backgroundColor: 'darkgray'}}
accessible={true}>
<Section title="뉴스">
</Section>
<Section title="커피빈">
</Section>
<Section title="쿠팡">
</Section>
<Section title="도서">
</Section>
<Section title="마켓">
</Section>
<Section title="꽃집">
</Section>
<Section title="배달">
</Section>
<Section title="쇼핑">
</Section>
</View>
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
sectionContainer: {
marginTop: 20,
paddingHorizontal: 30,
borderBottomColor: 'black', //구분선
borderBottomWidth: 1//구분선
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
},
sectionDescription: {
marginTop: 10,
fontSize: 18,
fontWeight: '400',
},
highlight: {
fontWeight: '700',
},
});
export default App;
color 코드는 여기서: https://runebook.dev/ko/docs/react_native/colors
우선 코드를 그나마 깔끔하게 하기 위해 안 쓰는 애들은 삭제, 다크모드도 우선 고려하지 않았다.
다음엔 stack을 만들어서 화면 전환을 시도해볼 것이다.
728x90
'FRONT > 리액트네이티브' 카테고리의 다른 글
[react native] ios 기기 연결 (0) | 2023.05.22 |
---|---|
react native typescript에서 navigation 으로 화면 전환 구현하기 (0) | 2023.05.05 |
react native 기본 제공 코드 분석 (App.tsx) (0) | 2023.05.05 |
아마 개발 1일차.. 실황 정리 (react native accessible / 안드로이드 기기 연결) (0) | 2023.05.02 |
리액트 네이티브 맥 Mac 설치 오류 타파 (23.04.28 기점) (0) | 2023.04.28 |