Notices.js 2.96 KB
import React, { Component } from 'react';
import { View, Text, StyleSheet,TouchableOpacity,Image, TextInput } from 'react-native';
import CheckBox from '@react-native-community/checkbox'
import X from '../../assets/X.svg'
import { ScrollView } from 'react-native-gesture-handler';
import Heart from '../../assets/heart_.svg'
import Chat from '../../assets/chat_.svg'
import Home from '../../assets/home.svg'
import QR from '../../assets/qr.svg'
import Alarm from '../../assets/alarm.svg'

import Notice from '../Notice'
import {get} from 'axios'
import { SERVER } from '../../common/servername';
import Loading from './Loading'
export default class AddTab extends Component {
    static navigationOptions = {
        
        headerShown: false
        
    }
    state = {
        notice:[],
        isLoading:true,
    }
    componentDidMount() {
        get(`http://${SERVER}/notices`).then(res => {
            this.setState({
                notice:res.data.data,
                isLoading:false
            })
        })
    }
    render() {
        return (
            <View style={{height:"100%"}}>
                <View style={{width:"100%",flexDirection:"row",paddingTop:16,paddingBottom:16,paddingLeft:16,backgroundColor:"#615F5F"}}>
                    <TouchableOpacity onPress={() => this.props.navigation.goBack(null)}>
                        <Image source={require('../../assets/back.png')}/>
                    </TouchableOpacity>
                    <Text style={{color:"white",fontSize:16,marginLeft:16}}>
                        공지사항
                    </Text>
                </View>
                {this.state.isLoading? <Loading/>:
            <ScrollView style={{width:"100%"}}>
                {this.state.notice.map((e,i) => {
                    return (
                        <Notice item={e} backgroundColor="white"/>
                    )

                })}
            </ScrollView>}
            <View style={{
                shadowColor: "#000",
                shadowOffset: {
                    width: 0,
                    height: 6,
                },
                shadowOpacity: 0.39,
                shadowRadius: 8.30,
                
                elevation: 13,
                flexDirection:"row",justifyContent:"space-between",paddingLeft:24,paddingRight:24,paddingTop:19,paddingBottom:19,width:"100%",position:"absolute",backgroundColor:"white",bottom:0}}>
                <Home onPress={() => this.props.navigation.navigate("Main_")}/>
                <Chat onPress={() => this.props.navigation.navigate("ChatTab")}/>
                <QR onPress={() => this.props.navigation.navigate("QRTab")}/>
                <Heart onPress={() => this.props.navigation.navigate("LikeTab")}/>
                <Alarm onPress={() => this.props.navigation.navigate("AlarmTab")}/>
            </View>
            </View>
        );
    }
}
 
const style = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    }
});