瀏覽代碼

Update a Calendar para poder entrar al mapa en caso de que se le pida una cita presencial

gilberto.cancel 2 年之前
父節點
當前提交
2e52f3dfb3
共有 1 個文件被更改,包括 61 次插入55 次删除
  1. 61
    55
      screens/main/Calendar.js

+ 61
- 55
screens/main/Calendar.js 查看文件

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