ordering-ui-react-native 0.13.8 → 0.13.9
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
|
@@ -104,6 +104,9 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
104
104
|
|
|
105
105
|
const [toggleTime, setToggleTime] = useState(false);
|
|
106
106
|
const [selectedTime, setSelectedTime] = useState(timeSelected);
|
|
107
|
+
const [minDate, setMinDate] = useState(new Date())
|
|
108
|
+
const [maxDate, setMaxDate] = useState(new Date)
|
|
109
|
+
const [alert, setAlert] = useState<any>({ show: false })
|
|
107
110
|
|
|
108
111
|
const goToBack = () => navigation?.canGoBack() && navigation.goBack();
|
|
109
112
|
|
|
@@ -173,6 +176,19 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
173
176
|
},
|
|
174
177
|
};
|
|
175
178
|
};
|
|
179
|
+
|
|
180
|
+
useEffect(() => {
|
|
181
|
+
if (datesList?.length > 0) {
|
|
182
|
+
const _datesList = datesList.slice(0, Number(configs?.max_days_preorder?.value || 6))
|
|
183
|
+
const minDateParts = _datesList[0].split('-')
|
|
184
|
+
const maxDateParts = _datesList[_datesList.length - 1].split('-')
|
|
185
|
+
const _minDate = new Date(minDateParts[0], minDateParts[1] - 1, minDateParts[2])
|
|
186
|
+
const _maxDate = new Date(maxDateParts[0], maxDateParts[1] - 1, maxDateParts[2])
|
|
187
|
+
setMinDate(_minDate)
|
|
188
|
+
setMaxDate(_maxDate)
|
|
189
|
+
}
|
|
190
|
+
}, [datesList])
|
|
191
|
+
|
|
176
192
|
return (
|
|
177
193
|
<>
|
|
178
194
|
<Container style={{ paddingLeft: 40, paddingRight: 40 }}>
|
|
@@ -309,7 +325,8 @@ const MomentOptionUI = (props: MomentOptionParams) => {
|
|
|
309
325
|
customDayHeaderStyles={customDayHeaderStylesCallback}
|
|
310
326
|
weekdays={weekDays}
|
|
311
327
|
selectedStartDate={momento}
|
|
312
|
-
minDate={
|
|
328
|
+
minDate={minDate}
|
|
329
|
+
maxDate={maxDate}
|
|
313
330
|
/>
|
|
314
331
|
</View>
|
|
315
332
|
)}
|