diff --git a/apps/mobile/app/components/date-picker/index.tsx b/apps/mobile/app/components/date-picker/index.tsx index 68f4c14ff..49d170252 100644 --- a/apps/mobile/app/components/date-picker/index.tsx +++ b/apps/mobile/app/components/date-picker/index.tsx @@ -19,7 +19,7 @@ along with this program. If not, see . import React from "react"; import { useThemeColors } from "@notesnook/theme"; import { useRef } from "react"; -import { View } from "react-native"; +import { useWindowDimensions, View } from "react-native"; import { defaultBorderRadius } from "../../utils/size"; import { DefaultAppStyles } from "../../utils/styles"; import DatePicker from "react-native-date-picker"; @@ -32,7 +32,10 @@ export default function DatePickerComponent(props: { onCancel: () => void; }) { const { colors, isDark } = useThemeColors(); - const dateRef = useRef(dayjs().add(1, "day").toDate()); + const dateRef = useRef(dayjs().add(1, "week").toDate()); + + const { width } = useWindowDimensions(); + return ( ; @@ -266,6 +267,21 @@ const NoteItem = ({ /> ) : null} + {item.expiryDate?.value ? ( + + ) : null} + {notebooks?.items ?.filter( (item) => diff --git a/apps/mobile/app/components/ui/expiry-date/index.tsx b/apps/mobile/app/components/ui/expiry-date/index.tsx new file mode 100644 index 000000000..f19c99f0d --- /dev/null +++ b/apps/mobile/app/components/ui/expiry-date/index.tsx @@ -0,0 +1,71 @@ +/* +This file is part of the Notesnook project (https://notesnook.com/) + +Copyright (C) 2023 Streetwriters (Private) Limited + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . +*/ +import { Note } from "@notesnook/core"; +import { useThemeColors } from "@notesnook/theme"; +import React from "react"; +import { TextStyle, ViewStyle } from "react-native"; +import { AppFontSize, defaultBorderRadius } from "../../../utils/size"; +import { DefaultAppStyles } from "../../../utils/styles"; +import { Button, ButtonProps } from "../button"; +import dayjs from "dayjs"; + +export const ExpiryDate = ({ + note, + color, + style, + textStyle, + iconSize, + short, + ...props +}: { + note: Note; + color?: string; + style?: ViewStyle; + textStyle?: TextStyle; + iconSize?: number; + short?: boolean; +} & ButtonProps) => { + const { colors } = useThemeColors(); + const expiryValue = note?.expiryDate?.value; + if (!expiryValue) return null; + + const formattedDate = dayjs(expiryValue).format("DD MMM YYYY"); + + return ( +