No Description

Calendar.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import React, { Component } from 'react';
  2. import {
  3. StyleSheet,
  4. Text,
  5. View
  6. } from 'react-native';
  7. //import CalendarPicker from 'react-native-calendar-picker';
  8. import {Calendar, CalendarList} from 'react-native-calendars';
  9. export default class Calendario extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. selectedStartDate: null,
  14. interpreter_id : this.props.route.params.Intereprete_id,
  15. };
  16. this.onDayPress = this.onDayPress.bind(this);
  17. }
  18. onDayPress(date) {
  19. this.setState({
  20. selectedStartDate: date,
  21. });
  22. this.props.navigation.navigate('StateTime', {Appointment_Date: date, int_id : this.state.interpreter_id});
  23. }
  24. render() {
  25. const { selectedStartDate } = this.state;
  26. const today = new Date();
  27. const appointment = selectedStartDate ? selectedStartDate.toString() : '';
  28. console.log(this.props.route.params)
  29. return (
  30. <View style={styles.container}>
  31. <Calendar
  32. onVisibleMonthsChange={(months) => {console.log('now these months are visible', months);}}
  33. minDate={today}
  34. onDayPress={this.onDayPress}
  35. />
  36. </View>
  37. );
  38. }
  39. }
  40. const styles = StyleSheet.create({
  41. container: {
  42. flex: 1,
  43. backgroundColor: '#FFFFFF',
  44. marginTop: 100,
  45. },
  46. });