glassdate-rn 0.1.0 → 0.2.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/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/GlassDatePicker.tsx +3 -1
- package/src/MonthSelector.tsx +1 -3
package/dist/index.js
CHANGED
|
@@ -1578,7 +1578,7 @@ function MonthSelector({
|
|
|
1578
1578
|
onDismiss
|
|
1579
1579
|
}) {
|
|
1580
1580
|
const popup = resolvedTokens.popup;
|
|
1581
|
-
const selectedMonth = selectedDate !== null
|
|
1581
|
+
const selectedMonth = selectedDate !== null ? selectedDate.getMonth() + 1 : null;
|
|
1582
1582
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_native4.Pressable, { onPress: onDismiss, style: [styles3.overlay, import_react_native4.Platform.select({ web: { userSelect: "none" } })], children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1583
1583
|
import_react_native4.View,
|
|
1584
1584
|
{
|
|
@@ -1947,6 +1947,7 @@ function GlassDatePicker({
|
|
|
1947
1947
|
const [viewYear, setViewYear] = (0, import_react2.useState)(initialView.getFullYear());
|
|
1948
1948
|
const [viewMonth, setViewMonth] = (0, import_react2.useState)(initialView.getMonth() + 1);
|
|
1949
1949
|
const [selectedDate, setSelectedDate] = (0, import_react2.useState)(null);
|
|
1950
|
+
const [userHasSelected, setUserHasSelected] = (0, import_react2.useState)(false);
|
|
1950
1951
|
const [openDropdown, setOpenDropdown] = (0, import_react2.useState)("none");
|
|
1951
1952
|
const activeTheme = theme ?? getDefaultTheme();
|
|
1952
1953
|
const systemColorScheme = (0, import_react_native7.useColorScheme)();
|
|
@@ -1977,7 +1978,7 @@ function GlassDatePicker({
|
|
|
1977
1978
|
...yearRange !== void 0 && { yearRange }
|
|
1978
1979
|
};
|
|
1979
1980
|
const resolvedBounds = resolveConstraintBounds(constraintConfig, today);
|
|
1980
|
-
const isConfirmEnabled = selectedDate !== null && isDateSelectableFromBounds(selectedDate, resolvedBounds);
|
|
1981
|
+
const isConfirmEnabled = selectedDate !== null && userHasSelected && isDateSelectableFromBounds(selectedDate, resolvedBounds);
|
|
1981
1982
|
const prev = previousMonth(viewYear, viewMonth);
|
|
1982
1983
|
const nxt = nextMonth(viewYear, viewMonth);
|
|
1983
1984
|
const isPrevArrowDisabled = !isMonthSelectable(prev.year, prev.month, constraintConfig, today);
|
|
@@ -2031,6 +2032,7 @@ function GlassDatePicker({
|
|
|
2031
2032
|
return;
|
|
2032
2033
|
}
|
|
2033
2034
|
setSelectedDate(date);
|
|
2035
|
+
setUserHasSelected(true);
|
|
2034
2036
|
setOpenDropdown("none");
|
|
2035
2037
|
onChange?.(date);
|
|
2036
2038
|
},
|