{"size": 1506, "ext": "js", "max_stars_repo_path": "components/AddPhotoButton.js", "max_stars_repo_name": "Nykollas/roomframes", "max_stars_repo_stars_event_min_datetime": "2020-04-12T03:56:41.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-28T20:01:39.000Z", "max_issues_repo_path": "components/AddPhotoButton.js", "max_issues_repo_name": "Nykollas/roomframes", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "components/AddPhotoButton.js", "max_forks_repo_name": "Nykollas/roomframes", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 24.6885245902, "max_line_length": 94, "alphanum_fraction": 0.5584329349}
import React, { Component } from 'react';
import {
    View,
    StyleSheet,
    TouchableOpacity,
} from 'react-native';
import Image from '../components/Image';
import {useNavigation} from "@react-navigation/native";
import defaultImage from '../assets/images/addphotobutton.png';




class AddPhotoButton extends Component{

    state = {
        selected:false,
        img:undefined
    }

    render = () => {
        
        const {selected, img} = this.state;
        const { navigation } = this.props;

        return(
            <View style={styles.container}>
        {selected ?
        
            
                <TouchableOpacity onPress={() => {navigation.navigate("AddPhoto")}}>
                    <Image resizeMode={"cover"} style={styles.img} img={img}></Image>
                </TouchableOpacity>   
        :
                <TouchableOpacity onPress={() => {navigation.navigate("AddPhoto")}}>
                    <Image resizeMode={"cover"} style={styles.img} img={defaultImage}></Image>
                </TouchableOpacity>
            
        }
        </View>
        )
    }
}


const styles = StyleSheet.create({
    container:{
        height: 180,
        paddingHorizontal: 16,
        marginBottom: 12,
    },
    img:{
        width:'100%',
    }
})

export default function AddPhotoButtonContainer(props){
        const navigation = useNavigation();
        console.log(navigation);
        return <AddPhotoButton {...props} navigation={navigation}></AddPhotoButton>
}