No Description

Calendar.js 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React, { Component } from 'react';
  2. import {StyleSheet,View} from 'react-native';
  3. import CalendarPicker from 'react-native-calendar-picker';
  4. export default class Calendario extends Component {
  5. constructor(props) {
  6. super(props);
  7. this.state = {
  8. selectedStartDate: null,
  9. interpreter_id : this.props.route.params.Intereprete_id,
  10. mapflag : this.props.route.params.Flag,
  11. };
  12. this.onDateChange = this.onDateChange.bind(this);
  13. }
  14. onDateChange(date) {
  15. this.setState({
  16. selectedStartDate: date,
  17. });
  18. console.log(date)
  19. console.log(this.props.route.params.Flag)
  20. if(this.state.mapflag == false){
  21. this.props.navigation.navigate('StateTime', {Appointment_Date: date._d, int_id : this.state.interpreter_id, Flag: this.state.mapflag});
  22. }
  23. else{
  24. this.props.navigation.navigate('Map', {Appointment_Date: date._d, int_id : this.state.interpreter_id, Flag: this.state.mapflag});
  25. }
  26. }
  27. render() {
  28. const { selectedStartDate } = this.state;
  29. const today = new Date();
  30. console.log(today)
  31. const appointment = selectedStartDate ? selectedStartDate.toString() : '';
  32. console.log(this.props.route.params)
  33. return (
  34. <View style = {styles.container}>
  35. <CalendarPicker
  36. minDate={today}
  37. onDateChange={this.onDateChange}
  38. selectionMode="singleDay"
  39. scrollMode="oneMonth"
  40. monthsAfter={24}
  41. />
  42. </View>
  43. );
  44. }
  45. }
  46. const styles = StyleSheet.create({
  47. container: {
  48. flex: 1,
  49. backgroundColor: '#FFFFFF',
  50. marginTop: 100,
  51. },
  52. });