ikualo-ui-kit-mobile 1.2.8 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ikualo-ui-kit-mobile",
3
- "version": "1.2.8",
3
+ "version": "1.3.0",
4
4
  "main": "src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -1,13 +1,13 @@
1
1
  import { HelperText, TextInput, Text } from 'react-native-paper';
2
2
  import { getStyleInput } from '../../../assets/styles/elements/inputs';
3
3
  import { useState } from 'react';
4
- import { View } from 'react-native';
4
+ import { Platform, View } from 'react-native';
5
5
  import React from 'react';
6
6
  import useStore from '../../store';
7
- import { IInputDate, IInputText } from '../../models';
7
+ import { IInputDate } from '../../models';
8
8
  import { ErrorInputIcon } from '../../../assets/icons/svgs';
9
9
  import { MaterialCommunityIcons } from '@expo/vector-icons';
10
- import RNDateTimePicker from '@react-native-community/datetimepicker';
10
+ import RNDateTimePicker, { DateTimePickerAndroid } from '@react-native-community/datetimepicker';
11
11
  import { DialogDown } from '../dialogs/DialogDown';
12
12
  import { BtnContained } from '../buttons/BtnContained';
13
13
 
@@ -59,6 +59,18 @@ export const InputDateTime = (props: IInputDate) => {
59
59
  return `${hours}:${minutes}`;
60
60
  }
61
61
  };
62
+
63
+ const showDateTimepicker = () => {
64
+ DateTimePickerAndroid.open({
65
+ value: value || new Date(),
66
+ onChange: (event, selectedDate) => {
67
+ if (event.type === 'set' && selectedDate) {
68
+ onChangeText(selectedDate);
69
+ }
70
+ },
71
+ mode: type === 'time' ? type : 'date',
72
+ });
73
+ };
62
74
  return (
63
75
  <View>
64
76
  <TextInput
@@ -93,6 +105,7 @@ export const InputDateTime = (props: IInputDate) => {
93
105
  <TextInput.Icon
94
106
  onPress={() => {
95
107
  setDialogDate(true);
108
+ Platform.OS === 'android' && showDateTimepicker();
96
109
  }}
97
110
  icon={(_) =>
98
111
  type === 'date' || type === 'datetime' ? (
@@ -153,33 +166,35 @@ export const InputDateTime = (props: IInputDate) => {
153
166
  )}
154
167
  </>
155
168
  )}
156
- <DialogDown
157
- isVisible={showDialogDate}
158
- title={label ?? ''}
159
- onDismiss={() => {
160
- setDialogDate(false);
161
- if (!value && required) {
162
- setErrorRequired(true);
163
- onInvalid && onInvalid();
164
- }
165
- }}
166
- >
167
- <RNDateTimePicker
168
- display="spinner"
169
- mode={type}
170
- locale={lang}
171
- value={value || new Date()}
172
- onChange={(event, date) => {
173
- if (date) onChangeText(date);
174
- }}
175
- />
176
- <BtnContained
177
- text={textBtnSave}
178
- onPress={() => {
169
+ {Platform.OS === 'ios' && (
170
+ <DialogDown
171
+ isVisible={showDialogDate}
172
+ title={label ?? ''}
173
+ onDismiss={() => {
179
174
  setDialogDate(false);
175
+ if (!value && required) {
176
+ setErrorRequired(true);
177
+ onInvalid && onInvalid();
178
+ }
180
179
  }}
181
- />
182
- </DialogDown>
180
+ >
181
+ <RNDateTimePicker
182
+ display="spinner"
183
+ mode={type}
184
+ locale={lang}
185
+ value={value || new Date()}
186
+ onChange={(event, date) => {
187
+ if (date) onChangeText(date);
188
+ }}
189
+ />
190
+ <BtnContained
191
+ text={textBtnSave}
192
+ onPress={() => {
193
+ setDialogDate(false);
194
+ }}
195
+ />
196
+ </DialogDown>
197
+ )}
183
198
  </View>
184
199
  );
185
200
  };
@@ -7,8 +7,6 @@ import { View } from 'react-native';
7
7
  import { InputsExamples } from '../inputs/InputsExamples';
8
8
  import { DialogExamples } from '../dialogs/DialogExamples';
9
9
  import { Others } from './Others';
10
- import { BtnContained, Navbar } from '../../';
11
- import { setGlobalTheme } from '../../config/paper.config';
12
10
  export const Views = () => {
13
11
  const [component, setComponent] = useState('');
14
12
  const components = [
@@ -22,24 +20,6 @@ export const Views = () => {
22
20
 
23
21
  return (
24
22
  <>
25
- <BtnContained
26
- text="light"
27
- onPress={() => {
28
- setGlobalTheme('light');
29
- }}
30
- />
31
- <BtnContained
32
- text="dark"
33
- onPress={() => {
34
- setGlobalTheme('dark');
35
- }}
36
- />
37
- <BtnContained
38
- text="system"
39
- onPress={() => {
40
- setGlobalTheme('system');
41
- }}
42
- />
43
23
  {components.find((c) => c.value === component)?.component ?? null}
44
24
 
45
25
  <View style={{ flex: 1, justifyContent: 'flex-end' }}>