No Description

Calendar.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. };
  15. this.onDayPress = this.onDayPress.bind(this);
  16. }
  17. onDayPress(date) {
  18. this.setState({
  19. selectedStartDate: date,
  20. });
  21. this.props.navigation.navigate('StateTime', {Appointment_Date: date});
  22. }
  23. render() {
  24. const { selectedStartDate } = this.state;
  25. const today = new Date();
  26. const appointment = selectedStartDate ? selectedStartDate.toString() : '';
  27. return (
  28. <View style={styles.container}>
  29. <Calendar
  30. onVisibleMonthsChange={(months) => {console.log('now these months are visible', months);}}
  31. minDate={today}
  32. onDayPress={this.onDayPress}
  33. />
  34. </View>
  35. );
  36. }
  37. }
  38. const styles = StyleSheet.create({
  39. container: {
  40. flex: 1,
  41. backgroundColor: '#FFFFFF',
  42. marginTop: 100,
  43. },
  44. });