Skip to content

Commit

Permalink
Merge pull request #50128 from nkdengineer/fix/49298
Browse files Browse the repository at this point in the history
fix: The intro text on private notes list stays fixed
  • Loading branch information
MonilBhavsar authored Oct 4, 2024
2 parents 575e904 + 8ebfd56 commit 4e12268
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions src/pages/PrivateNotes/PrivateNotesListPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type {RouteProp} from '@react-navigation/native';
import {useRoute} from '@react-navigation/native';
import React, {useCallback, useMemo} from 'react';
import type {OnyxEntry} from 'react-native-onyx';
import {withOnyx} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
import {AttachmentContext} from '@components/AttachmentContext';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
Expand All @@ -20,19 +19,13 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import type {PersonalDetailsList, Report} from '@src/types/onyx';
import type {Report} from '@src/types/onyx';

type PrivateNotesListPageOnyxProps = {
/** All of the personal details for everyone */
personalDetailsList: OnyxEntry<PersonalDetailsList>;
type PrivateNotesListPageProps = WithReportAndPrivateNotesOrNotFoundProps & {
/** The report currently being looked at */
report: Report;
};

type PrivateNotesListPageProps = WithReportAndPrivateNotesOrNotFoundProps &
PrivateNotesListPageOnyxProps & {
/** The report currently being looked at */
report: Report;
};

type NoteListItem = {
title: string;
action: () => void;
Expand All @@ -43,9 +36,10 @@ type NoteListItem = {
accountID: string;
};

function PrivateNotesListPage({report, personalDetailsList, session}: PrivateNotesListPageProps) {
function PrivateNotesListPage({report, session}: PrivateNotesListPageProps) {
const route = useRoute<RouteProp<PrivateNotesNavigatorParamList, typeof SCREENS.PRIVATE_NOTES.LIST>>();
const backTo = route.params.backTo;
const [personalDetailsList] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const styles = useThemeStyles();
const {translate} = useLocalize();
const getAttachmentValue = useCallback((item: NoteListItem) => ({reportID: item.reportID, accountID: Number(item.accountID), type: CONST.ATTACHMENT_TYPE.NOTE}), []);
Expand Down Expand Up @@ -102,11 +96,11 @@ function PrivateNotesListPage({report, personalDetailsList, session}: PrivateNot
onBackButtonPress={() => Navigation.goBack(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(report.reportID, backTo))}
onCloseButtonPress={() => Navigation.dismissModal()}
/>
<Text style={[styles.mb5, styles.ph5]}>{translate('privateNotes.personalNoteMessage')}</Text>
<ScrollView
contentContainerStyle={styles.flexGrow1}
bounces={false}
>
<Text style={[styles.mb5, styles.ph5]}>{translate('privateNotes.personalNoteMessage')}</Text>
{privateNotes.map((item) => getMenuItem(item))}
</ScrollView>
</ScreenWrapper>
Expand All @@ -115,10 +109,4 @@ function PrivateNotesListPage({report, personalDetailsList, session}: PrivateNot

PrivateNotesListPage.displayName = 'PrivateNotesListPage';

export default withReportAndPrivateNotesOrNotFound('privateNotes.title')(
withOnyx<PrivateNotesListPageProps, PrivateNotesListPageOnyxProps>({
personalDetailsList: {
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
},
})(PrivateNotesListPage),
);
export default withReportAndPrivateNotesOrNotFound('privateNotes.title')(PrivateNotesListPage);

0 comments on commit 4e12268

Please sign in to comment.