AuthCheck.js 3.73 KB
import React,{ Component } from 'react'

import {View,Text,RefreshControl,Image,ScrollView,Dimensions,TextInput,TouchableOpacity,StatusBar,StyleSheet,TouchableHighlight} from 'react-native'
import CheckBox from '@react-native-community/checkbox'
import { post, get, put, delete as remove } from 'axios'
class AuthCheck extends Component {

    state = {
        location:false,
        marketing:false,
    }
    constructor(props) {
        super(props)

    }
    componentDidMount() {

    }
    onChangeLocationAuth=()=> {
        if(this.state.location == false) {
            this.setState({
                location:true
            })
        }
        else {
            this.setState({
                location:false
            })
        }
    }
    onChangeMarketingAuth=()=> {
        if(this.state.marketing == false) {
            this.setState({
                marketing:true
            })
        }
        else {
            this.setState({
                marketing:false
            })
        }
    }
    onStartApp = () => {
        if(this.state.location === false) return alert('위치 기반 서비스 약관에 동의하셔야 합니다.')
        this.props.navigation.replace("Location_initiate",null)
    }
    render() {

        return (
            <View style={{height:"100%",width:"100%",backgroundColor:"white"}}>
            <View style={{backgroundColor:"white", paddingLeft:"5%",paddingRight:"5%", paddingTop:"10%"}}>
                <Text style={style.Title}>소비자와</Text>
                <Text style={style.Title}>소상공인을</Text>
                <Text style={style.Title}>위한 상가톡-</Text>
                
            <View style={{marginTop:30}}>
                <Text style={{fontSize:25}}>
                    아래 약관에 동의하시면
                </Text>
                <Text style={{fontSize:25}}>
                    다양한 서비스를 이용하실  있습니다.
                </Text>
            </View>
            <View style={{marginTop:30}}>
                <View style={{display:"flex",flexDirection:"row",justifyContent:"space-between"}}>
                    <Text style={{fontSize:14,marginBottom:10}}>
                        위치 기반 서비스 약관 동의(필수)
                    </Text>
                    <CheckBox onChange={this.onChangeLocationAuth} value = {this.state.location} tintColors={{true:'#f4cd37'}}  style={{marginTop:-5}}/>
                </View>
                
                <View style={{display:"flex",flexDirection:"row",justifyContent:"space-between"}}>
                    <Text style={{fontSize:14}}>
                        마케팅 정보  푸시 알림 수신 동의(선택)
                    </Text>
                    <CheckBox onChange={this.onChangeMarketingAuth} value = {this.state.marketing} tintColors={{true:'#f4cd37'}} style={{marginTop:-5}}/>
                </View>
            </View>
            </View>
            <View style={{display:"flex",flexDirection:"row",position:"absolute",bottom:0}}>
                <TouchableOpacity onPress={() => this.setState({marketing:true,location:true})} style={{flex:1,backgroundColor:"#f4cd37",padding:10}}>
                    <Text style={{textAlign:"center",fontSize:18,color:"white"}}>
                        전체동의
                    </Text>
                </TouchableOpacity>
                <TouchableOpacity onPress={() => this.onStartApp()} style={{flex:1,padding:10}}>
                    <Text style={{textAlign:"center",fontSize:18}}>
                        시작하기
                    </Text>
                </TouchableOpacity>
            </View>
            </View>
        )

    }

}

const style=StyleSheet.create({
    Title:{
        fontSize:50
    },
})
export default AuthCheck