Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Migrate renderInput

Manav Rathicf81d25b6a1d
diff --git a/web/packages/new/photos/components/PhotoDateTimePicker.tsx b/web/packages/new/photos/components/PhotoDateTimePicker.tsx
index c618871b3f..faf61c702a 100644
--- a/web/packages/new/photos/components/PhotoDateTimePicker.tsx
+++ b/web/packages/new/photos/components/PhotoDateTimePicker.tsx
@@ -75,6 +75,7 @@ export const PhotoDateTimePicker: React.FC<PhotoDateTimePickerProps> = ({
disabled={disabled}
disableFuture={true}
onAccept={handleAccept}
+ slots={{ field: EmptyField }}
DialogProps={{
sx: {
zIndex: "1502",
@@ -91,12 +92,22 @@ export const PhotoDateTimePicker: React.FC<PhotoDateTimePickerProps> = ({
},
},
}}
- renderInput={() => <></>}
/>
</LocalizationProvider>
);
};
+/**
+ * We don't wish to render any UI for the MUI DateTimePicker when it is closed,
+ * and instead only wish to use it as a dialog that we trigger ourselves.
+ *
+ * To achieve this we provide this nop-DOM element as the "field" slot to the
+ * date/time picker.
+ *
+ * See: https://mui.com/x/react-date-pickers/custom-field/
+ */
+const EmptyField: React.FC = () => <></>;
+
/**
* A variant of {@link parseMetadataDate} that does the same thing, but for
* {@link Dayjs} instances.