commit 293f99f859bbcf1562ae56f55ee1bf390798db95
Author: Fantič <58391275+FantaFantic@users.noreply.github.com>
Date:   Tue Oct 17 16:33:50 2023 +0200

    re #10819 ItemView notes: notesListView height refactor

diff --git a/src/components/item/ItemView.tsx b/src/components/item/ItemView.tsx
index 4d64295..9003717 100644
--- a/src/components/item/ItemView.tsx
+++ b/src/components/item/ItemView.tsx
@@ -11,6 +11,8 @@ import { AppDispatch, RootState } from "../../stores/store"
 import { useDispatch, useSelector } from "react-redux"
 import { getItemNotes } from "../../stores/actions/itemThunks"
 
+import { Dimensions } from "react-native";
+
 interface ItemDetailProps {
     item: Item,
     itemLoading: boolean,
@@ -170,7 +172,7 @@ const ItemNotes = (props: { item: Item, notes: Note[], notesLoading: boolean, na
                     <Switch value={showRelatedComments} onChange={toggleRelatedComments} size="md" />
                 </Flex>
                 <Box height="120%">
-                    <NotesListView requestPending={requestPending} notes={props.notes} navigation={props.navigation} handleCreateComment={handleCreateItemComment} />
+                    <NotesListView height={Dimensions.get('window').height - 70 - 160} requestPending={requestPending} notes={props.notes} navigation={props.navigation} handleCreateComment={handleCreateItemComment} />
                 </Box>
             </VStack>)
     );
diff --git a/src/components/notes/NotesListView.tsx b/src/components/notes/NotesListView.tsx
index 77c3e63..f98b68c 100644
--- a/src/components/notes/NotesListView.tsx
+++ b/src/components/notes/NotesListView.tsx
@@ -7,12 +7,11 @@ import { updateNote, deleteNote } from "../../stores/actions/notesThunks";
 import { ConfirmDialog } from "../general/Dialogs";
 import { AppDispatch } from "../../stores/store";
 import { useDispatch } from "react-redux";
-import { Dimensions } from "react-native";
 import { InfoToast } from "../toast/InfoToast";
 
 
 
-const NotesListView = (props: { notes: Note[], navigation: any, handleCreateComment: any, requestPending: boolean }) => {
+const NotesListView = (props: { notes: Note[], navigation: any, handleCreateComment: any, requestPending: boolean, height: number }) => {
     const notes = props.notes;
 
     const [newComment, setNewComment] = useState<string>("");
@@ -26,8 +25,6 @@ const NotesListView = (props: { notes: Note[], navigation: any, handleCreateComm
 
     const dispatch = useDispatch<AppDispatch>();
 
-    const windowHeight = Dimensions.get('window').height;
-
     const [confirmDialog, setConfirmDialog] = React.useState<{
         headerText?: string;
         bodyText?: string;
@@ -96,7 +93,7 @@ const NotesListView = (props: { notes: Note[], navigation: any, handleCreateComm
 
     return (
         <VStack>
-            <Box height={windowHeight - 70 - 160 - (replyingTo ? 40 : 0)} marginBottom={2}>
+            <Box height={props.height - (replyingTo ? 40 : 0) ?? undefined} marginBottom={2}>
                 {/* Notes */}
                 <ScrollView contentContainerStyle={{ flexGrow: 1 }} onScrollEndDrag={handleScrollEnd}>
                     {
diff --git a/src/pages/NotesViewPage.tsx b/src/pages/NotesViewPage.tsx
index 0b9bd9e..feb4be7 100644
--- a/src/pages/NotesViewPage.tsx
+++ b/src/pages/NotesViewPage.tsx
@@ -11,10 +11,13 @@ import LoadingBox from "../components/loading/LoadingBox"
 import { createNote, getAllNotes } from "../stores/actions/notesThunks"
 import { RootDrawerParamList } from "./Navigation"
 import { ErrorToast } from "../components/toast/ErrorToast"
+import { InfoToast } from "../components/toast/InfoToast"
+
+import { Dimensions } from "react-native";
 
 const NotesViewPage = ({ navigation }: DrawerScreenProps<RootDrawerParamList, 'Notes'>) => {
 
-  const { notes, notesLoading, requestPending, triggerRefresh } = useSelector((state: RootState) => state.noteViewState)
+  const { notes, notesLoading, requestPending, triggerRefresh } = useSelector((state: RootState) => state.noteViewState);
 
   const dispatch = useDispatch<AppDispatch>();
 
@@ -107,6 +110,14 @@ const NotesViewPage = ({ navigation }: DrawerScreenProps<RootDrawerParamList, 'N
 
     if (!requestPending) {
       // creating new comment
+      toast.show({
+        render: ({
+            id
+        }) => {
+            return <InfoToast  text={"Adding note"} onClose={() => toast.close(id)} />;
+        },
+        duration: 2000
+    });
       if (replyingTo != null) {
         dispatch(createNote({
           newNote: { note: newComment, reply_to: replyingTo.messageId } as Note
@@ -178,7 +189,7 @@ const NotesViewPage = ({ navigation }: DrawerScreenProps<RootDrawerParamList, 'N
             <LoadingBox text="Loading notes" />
           )
             :
-            (<NotesListView notes={notes} navigation={navigation} handleCreateComment={handleCreateComment} requestPending={requestPending} />)
+            (<NotesListView height={Dimensions.get('window').height - 70 - 160} notes={notes} navigation={navigation} handleCreateComment={handleCreateComment} requestPending={requestPending} />)
         }
 
 
