Location_initiate.js 4.31 KB
import React,{ Component } from 'react'

import {View,Text,RefreshControl,Image,ScrollView,Dimensions,TextInput,TouchableOpacity,StatusBar,StyleSheet} from 'react-native'
import { post, get, put, delete as remove } from 'axios'
import {AsyncStorage} from 'react-native'
import Modal from 'react-native-modal'
import SearchIcon from '../../assets/Search_icon.svg'
import FindPath from './FindPath'
import Postcode from '../Postcode'
class MainPage extends Component {

    state = {
        refreshing:false,
        isModalVisible:false,
    }

    constructor(props) {

        super(props)

    }
    _onRefresh = () => {
        this.setState({refreshing: true});
        this.setState({
            refreshing:false,
        })

    }
    componentDidMount() {

    }
    toggleModal = () => {
        if(this.state.isModalVisible == true) {
            this.setState({
                isModalVisible:false
            })
        }
        else {
            this.setState({
                isModalVisible:true
            })
        }
    }
    GotoMap = () => {
        AsyncStorage.setItem('isFirst',JSON.stringify({isFirst:true}))

        this.props.navigation.navigate("GoogleMap")
    }
    render() {

        return (
            <View style={{height:"100%",width:"100%",backgroundColor:"white",paddingTop:"10%",paddingLeft:"10%",paddingRight:"10%"}}>
                <Text style={{fontSize:14,textAlign:"center",color:"black"}}>도로명, 건물명, ///리를 입력하세요</Text>
                <View style={{}}>
                    <TouchableOpacity onPress={() => this.toggleModal()} style={{paddingTop:9,paddingBottom:9,borderColor:"#FFD63A",flexDirection:"row",alignSelf:"center",justifyContent:"space-between",marginTop:16,borderWidth:1,width:"80%",paddingLeft:10}}>
                        <Text>
                            ) 판교역로 235, 분당 주공, 삼평동
                        </Text>
                    <SearchIcon style={{alignSelf:"center",marginRight:15}}/>
                    </TouchableOpacity>
                </View>
                <TouchableOpacity onPress={() => this.GotoMap()} style={{alignSelf:"center", fontSize:14,marginTop:16,fontWeight:"bold"}}>
                    <Text style={{alignSelf:"center", fontSize:10,marginTop:16,fontWeight:"bold"}}>
                     위치로 주소설정
                    </Text>
                </TouchableOpacity>
                <Modal  onBackButtonPress={() => this.setState({isModalVisible:false})} onBackdropPress={() => this.setState({isModalVisible:false})} isVisible={this.state.isModalVisible}>
                    <View style={{width:"100%",height:"100%"}}>
                        <Postcode
                            jsOptions={{ animated: true }}
                            onSelected={(data) => {
                                this.toggleModal() 
                                this.props.navigation.navigate("GoogleMap",{address:data.address})
                                }}
                        />
                    </View>
                </Modal>
            </View>
        )

    }

}

const style=StyleSheet.create({
    list_pick_event: {
        paddingTop:17,
        paddingBottom:17,
        borderBottomColor:"#BBB9B9",
        borderTopColor:"#BBB9B9",
        borderBottomWidth:0.5,
    },
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    },
    avatar : {
        width:32,
        height:32,
        borderRadius:100,
    },
    detail: {
        marginLeft:15,
        flex:1,
        flexDirection:"row",
    },
    hit: {
        fontSize:9,
        fontWeight:"bold"
    },
    date: {
        marginLeft:9,
        fontSize:9,
        color:"black"
    },
    userWrapper : {
        flex:1,
        flexDirection:"row",
        paddingTop:13,
        paddingBottom:17,
        borderBottomColor:"#AEAEAE",
        borderBottomWidth:1,
    },
    nickname : {
        marginLeft:10,
        fontSize:13,
        fontWeight:"bold",
        color:"black"
    },
    title : {
        fontSize:13,
        fontWeight:"bold",
        color:"black"
    },
    like : {
        marginTop:3,
        fontSize:10,
        color:"red",
        marginLeft:5,
    },
    titleWrapper : {
        marginTop:17,
        paddingLeft:19,
        flex:1,
        flexDirection:"row"
    }
})
export default MainPage