@codeleap/mobile 3.14.0 → 3.14.2
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
|
@@ -87,6 +87,7 @@ const defaultProps:Partial<DatePickerModalProps> = {
|
|
|
87
87
|
commitDate: 'onConfirm',
|
|
88
88
|
showDoneButton: true,
|
|
89
89
|
isCustomModal: true,
|
|
90
|
+
toggleOnConfirm: true,
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
export const DatePickerModal = (props: DatePickerModalProps) => {
|
|
@@ -123,6 +124,8 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
|
|
|
123
124
|
minimumDate,
|
|
124
125
|
maximumDate,
|
|
125
126
|
footerComponent,
|
|
127
|
+
toggleOnConfirm,
|
|
128
|
+
onConfirm: _onConfirm,
|
|
126
129
|
...modalProps
|
|
127
130
|
} = allProps
|
|
128
131
|
|
|
@@ -153,14 +156,17 @@ export const DatePickerModal = (props: DatePickerModalProps) => {
|
|
|
153
156
|
const tempDate = useRef<Date|null>(null)
|
|
154
157
|
|
|
155
158
|
const onConfirm = () => {
|
|
156
|
-
|
|
157
159
|
if (commitDate == 'onConfirm' && !!tempDate.current) {
|
|
158
160
|
setValue(tempDate.current)
|
|
159
161
|
}
|
|
160
162
|
|
|
161
|
-
if (isCustomModal) {
|
|
163
|
+
if (isCustomModal && toggleOnConfirm) {
|
|
162
164
|
toggle()
|
|
163
165
|
}
|
|
166
|
+
|
|
167
|
+
if (TypeGuards.isFunction(_onConfirm)) {
|
|
168
|
+
_onConfirm?.(tempDate.current)
|
|
169
|
+
}
|
|
164
170
|
}
|
|
165
171
|
|
|
166
172
|
const modalFooter = footer || <Footer
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { ComponentVariants, StylesOf, FormTypes } from '@codeleap/common'
|
|
2
|
+
import { ComponentVariants, StylesOf, FormTypes, AnyFunction } from '@codeleap/common'
|
|
3
3
|
import { DatePickerModalComposition, DatePickerModalPresets } from './styles'
|
|
4
4
|
import { DatePickerProps } from 'react-native-date-picker'
|
|
5
5
|
import { TextInputComposition } from '../TextInput'
|
|
@@ -55,4 +55,8 @@ export type DatePickerModalProps = Omit<ModalProps, 'styles' | 'variants' | 'ref
|
|
|
55
55
|
minimumDate?: DatePickerProps['minimumDate']
|
|
56
56
|
|
|
57
57
|
maximumDate?: DatePickerProps['maximumDate']
|
|
58
|
+
|
|
59
|
+
toggleOnConfirm?: boolean
|
|
60
|
+
|
|
61
|
+
onConfirm?: (value: Date) => void
|
|
58
62
|
} & ComponentVariants<typeof DatePickerModalPresets>
|