Skip to content

Commit

Permalink
remove withOnyx
Browse files Browse the repository at this point in the history
  • Loading branch information
nkdengineer committed Sep 23, 2024
1 parent fda0283 commit 83a05a0
Showing 1 changed file with 7 additions and 26 deletions.
33 changes: 7 additions & 26 deletions src/pages/tasks/TaskAssigneeSelectorModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type {RouteProp} from '@react-navigation/native';
import {useRoute} from '@react-navigation/native';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {InteractionManager, View} from 'react-native';
import {useOnyx, withOnyx} from 'react-native-onyx';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import {useBetas, useSession} from '@components/OnyxProvider';
Expand All @@ -14,9 +14,7 @@ import SelectionList from '@components/SelectionList';
import type {ListItem} from '@components/SelectionList/types';
import UserListItem from '@components/SelectionList/UserListItem';
import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails';
import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails';
import withNavigationTransitionEnd from '@components/withNavigationTransitionEnd';
import type {WithNavigationTransitionEndProps} from '@components/withNavigationTransitionEnd';
import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails';
import useDebouncedState from '@hooks/useDebouncedState';
import useLocalize from '@hooks/useLocalize';
Expand All @@ -33,17 +31,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import type {Report, Task} from '@src/types/onyx';

type TaskAssigneeSelectorModalOnyxProps = {
/** All reports shared with the user */
reports: OnyxCollection<Report>;

/** Grab the Share destination of the Task */
task: OnyxEntry<Task>;
};

type TaskAssigneeSelectorModalProps = TaskAssigneeSelectorModalOnyxProps & WithCurrentUserPersonalDetailsProps & WithNavigationTransitionEndProps;
import type {Report} from '@src/types/onyx';

function useOptions() {
const betas = useBetas();
Expand Down Expand Up @@ -111,11 +99,13 @@ function useOptions() {
return {...options, searchValue, debouncedSearchValue, setSearchValue, areOptionsInitialized};
}

function TaskAssigneeSelectorModal({reports, task}: TaskAssigneeSelectorModalProps) {
function TaskAssigneeSelectorModal() {
const styles = useThemeStyles();
const route = useRoute<RouteProp<TaskDetailsNavigatorParamList, typeof SCREENS.TASK.ASSIGNEE>>();
const {translate} = useLocalize();
const session = useSession();
const [reports] = useOnyx(ONYXKEYS.COLLECTION.REPORT);
const [task] = useOnyx(ONYXKEYS.TASK);
const [isSearchingForReports] = useOnyx(ONYXKEYS.IS_SEARCHING_FOR_REPORTS, {initWithStoredValues: false});
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
const {userToInvite, recentReports, personalDetails, currentUserOption, searchValue, debouncedSearchValue, setSearchValue, headerMessage, areOptionsInitialized} = useOptions();
Expand Down Expand Up @@ -259,13 +249,4 @@ function TaskAssigneeSelectorModal({reports, task}: TaskAssigneeSelectorModalPro

TaskAssigneeSelectorModal.displayName = 'TaskAssigneeSelectorModal';

const TaskAssigneeSelectorModalWithOnyx = withOnyx<TaskAssigneeSelectorModalProps, TaskAssigneeSelectorModalOnyxProps>({
reports: {
key: ONYXKEYS.COLLECTION.REPORT,
},
task: {
key: ONYXKEYS.TASK,
},
})(TaskAssigneeSelectorModal);

export default withNavigationTransitionEnd(withCurrentUserPersonalDetails(TaskAssigneeSelectorModalWithOnyx));
export default withNavigationTransitionEnd(withCurrentUserPersonalDetails(TaskAssigneeSelectorModal));

0 comments on commit 83a05a0

Please sign in to comment.