비망록 프로그램의 홈페이지 화면에 구성 요소가 없습니다.

15819 단어 reactnative

홈 화면 설치


우선 구성 요소를 고려하지 않고 App을 선택한다.jsx에 메모장 응용 프로그램의 홈 화면을 설치합니다.
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

// eslint-disable-next-line react/function-component-definition
export default function App() {
  return (
    <View style={styles.container}>

      <View style={styles.appbar}>
        <View style={styles.appbarInner}>
          <Text style={styles.appbarTitle}>MEMO</Text>
          <Text style={styles.appbarLogout}>ログアウト</Text>
        </View>
      </View>

      <View>

        <View style={styles.memoItem}>
          <View>
            <Text style={styles.memoItemTitle}>買い物</Text>
            <Text style={styles.memoItemDate}>2020年12月22日 10:00</Text>
          </View>
          <View>
            <Text>x</Text>
          </View>
        </View>

        <View style={styles.memoItem}>
          <View>
            <Text style={styles.memoItemTitle}>買い物2</Text>
            <Text style={styles.memoItemDate}>2020年12月22日 10:00</Text>
          </View>
          <View>
            <Text>x</Text>
          </View>
        </View>

      </View>

      <View style={styles.circleButton}>
        <Text style={styles.circleButtonLabel}>+</Text>
      </View>

    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#FCE4EC',
  },
  appbar: {
    width: '100%',
    height: 110,
    backgroundColor: '#C51162',
    justifyContent: 'flex-end',
  },
  appbarInner: {
    alignItems: 'center',
  },
  appbarTitle: {
    color: '#fff',
    fontSize: 24,
    lineHeight: 32,
    fontWeight: 'bold',
    marginBottom: 8,
  },
  appbarLogout: {
    position: 'absolute',
    right: 20,
    bottom: 12,
    color: 'rgba(255,255,255,0.7)',
  },
  memoItem: {
    backgroundColor: '#fff',
    flexDirection: 'row',
    justifyContent: 'space-between',
    paddingVertical: 16,
    paddingHorizontal: 19,
    alignItems: 'center',
    borderBottomWidth: 1,
    borderColor: 'rgba(0,0,0,0.20)',
  },
  memoItemTitle: {
    fontSize: 16,
    lineHeight: 32,
  },
  memoItemDate: {
    fontSize: 12,
    lineHeight: 16,
    color: '#616161',
  },
  circleButton: {
    backgroundColor: '#C51162',
    width: 65,
    height: 65,
    borderRadius: 32,
    justifyContent: 'center',
    alignItems: 'center',
    position: 'absolute',
    right: 40,
    bottom: 40,
    /* shadowはiphoneにしか効かないCSS */
    shadowColor: '#000',
    shadowOffset: { width: 0, height: 8 },
    shadowOpacity: 0.35,
    shadowRadius: 5,
    /* elevationはAndroid用のCSS */
    elevation: 8,
  },
  circleButtonLabel: {
    color: '#fff',
    fontSize: 32,
    lineHeight: 32,
    fontWeight: 'bold',
  },
});

스마트폰 화면은 이렇다.

좋은 웹페이지 즐겨찾기