소스 검색

Calendar para citas

Me di cuenta que el calendario no permite mover de mes a mes tradicionalmente, lo estoy trabajando, pero en lo que lo envio para que lo tengan y despues le pongo los cambios cuando este bien
gilberto.cancel 3 년 전
부모
커밋
dfcbc32313
1개의 변경된 파일53개의 추가작업 그리고 0개의 파일을 삭제
  1. 53
    0
      screens/main/Calendar.js

+ 53
- 0
screens/main/Calendar.js 파일 보기

@@ -0,0 +1,53 @@
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
+
10
+
11
+export default class Calendario extends Component {
12
+  constructor(props) {
13
+    super(props);
14
+    this.state = {
15
+      selectedStartDate: null,
16
+    };
17
+    this.onDayPress = this.onDayPress.bind(this);
18
+    
19
+  }
20
+
21
+  onDayPress(date) {
22
+    this.setState({
23
+      selectedStartDate: date,
24
+    });
25
+
26
+    this.props.navigation.navigate('StateTime', {Appointment_Date: date});
27
+  }
28
+  
29
+  render() {
30
+    const { selectedStartDate } = this.state;
31
+    const today = new Date();
32
+    const appointment = selectedStartDate ? selectedStartDate.toString() : '';
33
+    return (
34
+      <View style={styles.container}>
35
+        <Calendar
36
+        onVisibleMonthsChange={(months) => {console.log('now these months are visible', months);}}
37
+          minDate={today}
38
+          onDayPress={this.onDayPress}
39
+        />
40
+      </View>
41
+    );
42
+  }
43
+}
44
+
45
+const styles = StyleSheet.create({
46
+  container: {
47
+    flex: 1,
48
+    backgroundColor: '#FFFFFF',
49
+    marginTop: 100,
50
+  },
51
+});
52
+   
53
+