58 lines
2.2 KiB
TypeScript
58 lines
2.2 KiB
TypeScript
// Metro module 16128 (f16129).
|
|
import { forwardRef, useRef, useImperativeHandle } from "react";
|
|
import { Keyboard } from "react-native";
|
|
import Module3771 from "../../../../_bundle/Module3771";
|
|
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
|
|
import FreeFormInputGroup from "../../../../design/void/Form/native/FreeFormInputGroup";
|
|
import { ClearButtonVisibility } from "../../../../design/void/native";
|
|
const r23 = forwardRef(function({ date, onChangeDate, label, style, error }, a1) {
|
|
let ref, openDatePicker2;
|
|
ref = void 0;
|
|
const updateDate2 = function updateDate(a0) {
|
|
onChangeDate(a0);
|
|
const current = ref.current;
|
|
if (current != null) {
|
|
current.blur();
|
|
}
|
|
};
|
|
openDatePicker2 = function openDatePicker() {
|
|
Keyboard.dismiss();
|
|
const r21 = import("../../../../components_native/DatePickerActionSheet");
|
|
let startDate = date == null ? void 0 : date.toDate();
|
|
if (startDate == null) {
|
|
const r29 = Module3771();
|
|
r29.set("year", r29.year() - 10);
|
|
startDate = r29.toDate();
|
|
}
|
|
const r38 = Module3771();
|
|
r38.set("year", r38.year() - 3);
|
|
const r24 = {
|
|
onSubmit: updateDate2,
|
|
title: label,
|
|
startDate,
|
|
maximumDate: r38.toDate(),
|
|
minimumDate: null,
|
|
requireDateChanged: true
|
|
};
|
|
const r50 = Module3771();
|
|
r50.set("year", r50.year() - 100);
|
|
r24.minimumDate = r50.toDate();
|
|
ActionSheetActionCreators.openLazy(r21, "DatePicker", r24);
|
|
};
|
|
ref = useRef(null);
|
|
useImperativeHandle(a1, () => ({
|
|
focus: () => {
|
|
openDatePicker2();
|
|
}
|
|
}));
|
|
let r23 = date == null ? void 0 : date.format("L");
|
|
if (r23 == null) {
|
|
r23 = void 0;
|
|
}
|
|
const r31 = Module3771();
|
|
r31.set("year", r31.year() - 10);
|
|
const placeholder = Module3771(r31.toDate()).format("L");
|
|
return <FreeFormInputGroup style={style} ref={ref} value={r23 == null ? "" : r23} placeholder={placeholder} returnKeyType="next" textContentType="none" autoCapitalize="none" clearButtonVisibility={ClearButtonVisibility.NEVER} editable={false} forceAccessibleContainer accessibilityLabel={`${label}, ${r23 ?? placeholder}`} onPress={openDatePicker2} label={label} error={error} />;
|
|
});
|
|
export default r23;
|