No Description

StateTime.js 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from "react";
  2. import firebase from "firebase";
  3. import { Component } from "react";
  4. import { TouchableWithoutFeedback, ImageBackground, Text } from "react-native";
  5. import { styles } from "../../config/styles";
  6. import CustomButton from "../../components/CustomButton";
  7. export default class Time extends Component{
  8. constructor(props){
  9. super(props);
  10. this.state = {
  11. Appointment : this.props.route.params.Appointment_Date,
  12. }
  13. this.time_assignment = this.time_assignment.bind(this);
  14. }
  15. time_assignment(desired_time, selectedTime){
  16. if(desired_time == 1){
  17. selectedTime = "8:00am-9:00am"
  18. }
  19. console.log(this.props.route.params)
  20. const user = firebase.auth().currentUser
  21. const uid = user.uid
  22. const month = this.state.Appointment.month
  23. const day = this.state.Appointment.day
  24. const _time_ = selectedTime
  25. firebase.firestore()
  26. .collection('APPOINTMENTS')
  27. .add({
  28. uid1: uid,
  29. Month : month,
  30. Day: day,
  31. Time: _time_})
  32. this.props.navigation.navigate('Home')
  33. }
  34. render(){
  35. return(
  36. <TouchableWithoutFeedback style={styles.stdcontainer}>
  37. <ImageBackground style={styles.regcontainer} source={require('../../assets/yellow-white.jpg')}>
  38. <Text style={styles.stdcontainer}> Please select a time frame for the appointment</Text>
  39. <CustomButton marginTop={25} title="8:00am-9:00am" onPress={() => this.time_assignment(1,)}/>
  40. </ImageBackground>
  41. </TouchableWithoutFeedback>
  42. );
  43. }
  44. }