ErnestoOrtiz2 2 years ago
parent
commit
fa2ed6e0ae
2 changed files with 34 additions and 25 deletions
  1. 26
    25
      screens/main/Calendar.js
  2. 8
    0
      screens/main/Confirm.js

+ 26
- 25
screens/main/Calendar.js View File

@@ -1,12 +1,12 @@
1 1
 import React, { Component } from 'react';
2 2
 import {StyleSheet,View} from 'react-native';
3
-import CalendarPicker from 'react-native-calendar-picker';
4
-
3
+import { Calendar } from 'react-native-calendars';
5 4
 
6 5
 export default class Calendario extends Component {
7 6
   constructor(props) {
8 7
     super(props);
9 8
     this.state = {
9
+      markedDates: this.props.route.params.markedDates,
10 10
       selectedStartDate: null,
11 11
       interpreter_id : this.props.route.params.Intereprete_id,
12 12
       mapflag : this.props.route.params.Flag,
@@ -16,45 +16,49 @@ export default class Calendario extends Component {
16 16
       I_username: this.props.route.params.I_Username,
17 17
     };
18 18
     this.onDateChange = this.onDateChange.bind(this);
19
-    
20 19
   }
21 20
 
21
+  componentDidMount(){
22
+    this.forceUpdate();
23
+    this.setState({markedDates: this.props.route.params.markedDates});
24
+  };
25
+
22 26
   onDateChange(date) {
23 27
     this.setState({
24 28
       selectedStartDate: date,
25 29
     });
26
-    console.log(date)
27
-    console.log(this.props.route.params.Flag)
28 30
     
29
-    if(this.state.mapflag == false){
30
-      this.props.navigation.navigate('StateTime', {Appointment: date._d, int_id : this.state.interpreter_id, 
31
-        Flag: this.state.mapflag, I_Token: this.state.i_token, U_Token: this.state.u_token
32
-        ,Username: this.state.username, I_Username: this.state.I_username});
33
-    }
34
-    else{
35
-      this.props.navigation.navigate('Map', {Appointment_Date: date._d, int_id : this.state.interpreter_id, 
36
-        Flag: this.state.mapflag, I_Token: this.state.i_token, U_Token: this.state.u_token
37
-        ,Username: this.state.username, I_Username: this.state.I_username});
31
+    if(this.state.markedDates[date.dateString] != undefined){
32
+      if(this.state.markedDates[date.dateString].selected == true){
33
+        if(this.state.mapflag == false){
34
+          this.props.navigation.navigate('StateTime', {Appointment: date._d, int_id : this.state.interpreter_id, 
35
+            Flag: this.state.mapflag, I_Token: this.state.i_token, U_Token: this.state.u_token
36
+            ,Username: this.state.username, I_Username: this.state.I_username});
37
+        }
38
+        else{
39
+          this.props.navigation.navigate('Map', {Appointment_Date: date._d, int_id : this.state.interpreter_id, 
40
+            Flag: this.state.mapflag, I_Token: this.state.i_token, U_Token: this.state.u_token
41
+            ,Username: this.state.username, I_Username: this.state.I_username});
42
+        }
43
+      }
38 44
     }
39 45
   }
40 46
   
41 47
   render() {
42 48
     const { selectedStartDate } = this.state;
43 49
     const today = new Date();
44
-    console.log(today)
45
-    const appointment = selectedStartDate ? selectedStartDate.toString() : '';
46
-    console.log(this.props.route.params)
50
+    //const appointment = selectedStartDate ? selectedStartDate.toString() : '';
47 51
     return (
48 52
       <View style = {styles.container}>
49
-        <CalendarPicker
53
+        <Calendar
54
+          markedDates={this.state.markedDates}
50 55
           minDate={today}
51
-          onDateChange={this.onDateChange}
56
+          onDayPress={this.onDateChange}
52 57
           selectionMode="singleDay"
53 58
           scrollMode="oneMonth"
54 59
           monthsAfter={24}
55 60
           
56
-        />
57
-        
61
+        />   
58 62
         </View>
59 63
     );
60 64
   }
@@ -66,7 +70,4 @@ const styles = StyleSheet.create({
66 70
     backgroundColor: '#FFFFFF',
67 71
     marginTop: 100,
68 72
   },
69
-});
70
-   
71
-  
72
-
73
+});

+ 8
- 0
screens/main/Confirm.js View File

@@ -127,6 +127,14 @@ export function Confirm({route, navigation}) {
127 127
             console.log("date");
128 128
           }}
129 129
           >
130
+            <List.Item
131
+            title='Usuario:'
132
+            description={item.User}
133
+            titleNumberOfLines={1}
134
+            titleStyle={styles.listTitle}
135
+            descriptionStyle={styles.listDescription}
136
+            descriptionNumberOfLines={1}
137
+          />
130 138
           <List.Item
131 139
             title='Usuario:'
132 140
             description={item.User}