Просмотр исходного кода

kind of fixed date picker for ios

master
Elias Sebbar 2 лет назад
Родитель
Сommit
c8df193d04
1 измененных файлов: 9 добавлений и 13 удалений
  1. 9
    13
      components/depense_edit/depense_form.js

+ 9
- 13
components/depense_edit/depense_form.js Просмотреть файл

@@ -2,6 +2,7 @@ import React from 'react';
2 2
 import { StyleSheet, Text, View, TextInput, Alert, Pressable } from 'react-native';
3 3
 import { sqlite_exec_parameterised } from '../../db/query';
4 4
 import DateTimePicker from '@react-native-community/datetimepicker';
5
+import { SafeAreaView } from 'react-native-safe-area-context';
5 6
 
6 7
 
7 8
 export default function DepenseForm(props){
@@ -16,9 +17,6 @@ export default function DepenseForm(props){
16 17
 
17 18
     let update_depense = null != props.depense;
18 19
 
19
-    const toggleDateInput = () => {
20
-        onDatePicker(true);
21
-    }
22 20
 
23 21
     return (
24 22
         <View style={ depense_form_styles.form_area }>
@@ -46,15 +44,14 @@ export default function DepenseForm(props){
46 44
                 </View>
47 45
                 <View style={ depense_form_styles.form_entry }>
48 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 55
                         testID="dateTimePicker"
59 56
                         value={depenseDate}
60 57
                         mode={"date"}
@@ -70,7 +67,6 @@ export default function DepenseForm(props){
70 67
                         }}
71 68
                         />
72 69
                     }
73
-                </View>
74 70
                 <Pressable 
75 71
                     style={depense_form_styles.button_add} 
76 72
                     onPress={() => 

Загрузка…
Отмена
Сохранить