WalkPathComponent.js 2.09 KB
import React, {useState, useContext, useEffect, useCallback} from 'react';
import {Text, View, StyleSheet, TouchableOpacity, ScrollView, TextInput} from 'react-native';
import {useDispatch, useSelector} from "react-redux";
import {useNavigation} from '@react-navigation/native';
import styled from "styled-components";
import {MaterialCommunityIcons, AntDesign} from '@expo/vector-icons';


const Banner = styled.View`
    flex: 1;
    margin-left: 15px;
    margin-bottom: 5px;
    width: 3px;
    height: 3px;
    border-radius: 20px;
    border: 3px solid grey;
    
`;


const WalkPathComponent = (props) => {
    const navigation = useNavigation();
    const [walkPath, setWalkPath] = useState(null);
    const {pathDetail} = props;

    useEffect(() => {
        console.log(props.pathDetail.distance);
        setWalkPath(props.pathDetail);
    }, []);

    return (
        <ScrollView>
            <View style={{flexDirection: 'row', flex: 5}}>
                <View style={styles.pathType}>
                    <MaterialCommunityIcons style={{flex: 1}} color={'darkgrey'} name={'walk'} size={20}/>
                    <Text style={{flex: 1, fontSize: 13}}>{pathDetail.time}</Text>
                </View>
                <View style={{flex: 1}}>
                    <Banner/>
                    <Banner/>
                    <Banner/>
                    <Banner/>
                    <Banner/>
                    <Banner/>
                    <Banner/>
                </View>
                <View style={styles.inputTile}>
                    <Text style={styles.inputText}> 도보 {pathDetail.distance}m 이동</Text>
                </View>
            </View>
        </ScrollView>
    );
}
export default WalkPathComponent;

const styles = StyleSheet.create({
    inputTile: {
        flex: 4,
        justifyContent: 'center',
        color: 'grey',
    },
    inputText: {
        fontWeight: 'normal',
        fontSize: 15,
    },
    pathType: {
        flexDirection: 'column',
        flex: 0.4,
        alignItems: 'center',
        justifyContent: 'center',
        marginLeft: 5,
        marginTop: 10,
    }
})