No Description

StateTime.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. int2_id : this.props.route.params.int_id,
  13. }
  14. this.time_assignment = this.time_assignment.bind(this);
  15. }
  16. time_assignment(desired_time, selectedTime){
  17. if(desired_time == 1){
  18. selectedTime = "8:00am-9:00am"
  19. }
  20. console.log(this.props.route.params)
  21. const user = firebase.auth().currentUser
  22. const uid = user.uid
  23. const month = this.state.Appointment.month
  24. const day = this.state.Appointment.day
  25. const _time_ = selectedTime
  26. const i_id = this.state.int2_id
  27. firebase.firestore()
  28. .collection('APPOINTMENTS')
  29. .add({
  30. i_id : i_id,
  31. uid1: uid,
  32. Month : month,
  33. Day: day,
  34. Time: _time_})
  35. this.props.navigation.navigate('Home')
  36. }
  37. render(){
  38. return(
  39. <TouchableWithoutFeedback style={styles.stdcontainer}>
  40. <ImageBackground style={styles.regcontainer} source={require('../../assets/yellow-white.jpg')}>
  41. <Text style={styles.stdcontainer}> Please select a time frame for the appointment</Text>
  42. <CustomButton marginTop={25} title="8:00am-9:00am" onPress={() => this.time_assignment(1,)}/>
  43. </ImageBackground>
  44. </TouchableWithoutFeedback>
  45. );
  46. }
  47. }