Browse Source

kind of fixed date picker for ios

master
Elias Sebbar 3 years ago
parent
commit
c8df193d04
1 changed files with 9 additions and 13 deletions
  1. 9
    13
      components/depense_edit/depense_form.js

+ 9
- 13
components/depense_edit/depense_form.js View File

2
 import { StyleSheet, Text, View, TextInput, Alert, Pressable } from 'react-native';
2
 import { StyleSheet, Text, View, TextInput, Alert, Pressable } from 'react-native';
3
 import { sqlite_exec_parameterised } from '../../db/query';
3
 import { sqlite_exec_parameterised } from '../../db/query';
4
 import DateTimePicker from '@react-native-community/datetimepicker';
4
 import DateTimePicker from '@react-native-community/datetimepicker';
5
+import { SafeAreaView } from 'react-native-safe-area-context';
5
 
6
 
6
 
7
 
7
 export default function DepenseForm(props){
8
 export default function DepenseForm(props){
16
 
17
 
17
     let update_depense = null != props.depense;
18
     let update_depense = null != props.depense;
18
 
19
 
19
-    const toggleDateInput = () => {
20
-        onDatePicker(true);
21
-    }
22
 
20
 
23
     return (
21
     return (
24
         <View style={ depense_form_styles.form_area }>
22
         <View style={ depense_form_styles.form_area }>
46
                 </View>
44
                 </View>
47
                 <View style={ depense_form_styles.form_entry }>
45
                 <View style={ depense_form_styles.form_entry }>
48
                     <Text> 📅</Text>
46
                     <Text> 📅</Text>
49
-                    <TextInput 
50
-                    onPressIn={ () => toggleDateInput()}
51
-                    value={ depenseDate.toDateString() } style={ depense_form_styles.input }
52
-                        onChangeText={ (value) => {
53
-                            onDescriptionEdit(value);
54
-                        }}
55
-                    />
56
-                    {/* https://github.com/react-native-datetimepicker/datetimepicker */}
57
-                    { timePickerDisplay && <DateTimePicker
47
+                    <Pressable onPress={ () => onDatePicker(true)} style={ depense_form_styles.input }>
48
+                    <Text >
49
+                    { depenseDate.toDateString() } 
50
+                    </Text>
51
+                    </Pressable>
52
+                </View>
53
+                {/* https://github.com/react-native-datetimepicker/datetimepicker */}
54
+                { timePickerDisplay && <DateTimePicker
58
                         testID="dateTimePicker"
55
                         testID="dateTimePicker"
59
                         value={depenseDate}
56
                         value={depenseDate}
60
                         mode={"date"}
57
                         mode={"date"}
70
                         }}
67
                         }}
71
                         />
68
                         />
72
                     }
69
                     }
73
-                </View>
74
                 <Pressable 
70
                 <Pressable 
75
                     style={depense_form_styles.button_add} 
71
                     style={depense_form_styles.button_add} 
76
                     onPress={() => 
72
                     onPress={() => 

Loading…
Cancel
Save