Skip to content

Commit 2b60ac5

Browse files
committed
Fix: Remove UserListSkeletonView
1 parent ee1ec27 commit 2b60ac5

File tree

5 files changed

+37
-48
lines changed

5 files changed

+37
-48
lines changed

src/components/OptionsListSkeletonView.tsx

+33-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import {Circle, Rect} from 'react-native-svg';
3+
import useThemeStyles from '@hooks/useThemeStyles';
34
import ItemListSkeletonView from './Skeletons/ItemListSkeletonView';
45

56
function getLinedWidth(index: number): string {
@@ -17,9 +18,40 @@ function getLinedWidth(index: number): string {
1718

1819
type OptionsListSkeletonViewProps = {
1920
shouldAnimate?: boolean;
21+
isUserList?: boolean;
2022
};
2123

22-
function OptionsListSkeletonView({shouldAnimate = true}: OptionsListSkeletonViewProps) {
24+
function OptionsListSkeletonView({shouldAnimate = true, isUserList = false}: OptionsListSkeletonViewProps) {
25+
const styles = useThemeStyles();
26+
if (isUserList) {
27+
return (
28+
<ItemListSkeletonView
29+
shouldAnimate={shouldAnimate}
30+
itemViewStyle={[styles.highlightBG, styles.mb3, styles.mh5, styles.br2]}
31+
renderSkeletonItem={() => (
32+
<>
33+
<Circle
34+
cx="40"
35+
cy="32"
36+
r="20"
37+
/>
38+
<Rect
39+
x="72"
40+
y="18"
41+
width="20%"
42+
height="8"
43+
/>
44+
<Rect
45+
x="72"
46+
y="38"
47+
width="10%"
48+
height="8"
49+
/>
50+
</>
51+
)}
52+
/>
53+
);
54+
}
2355
return (
2456
<ItemListSkeletonView
2557
shouldAnimate={shouldAnimate}

src/components/SelectionList/BaseSelectionList.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function BaseSelectionList<TItem extends ListItem>(
3636
{
3737
sections,
3838
ListItem,
39-
SkeletonView,
39+
shouldUseUserSkeletonView,
4040
canSelectMultiple = false,
4141
onSelectRow,
4242
shouldDebounceRowSelect = false,
@@ -629,8 +629,6 @@ function BaseSelectionList<TItem extends ListItem>(
629629
},
630630
);
631631

632-
const getSkeletonView = useCallback(() => (SkeletonView ? <SkeletonView shouldAnimate /> : <OptionsListSkeletonView shouldAnimate />), [SkeletonView]);
633-
634632
return (
635633
<SafeAreaConsumer>
636634
{({safeAreaPaddingBottomStyle}) => (
@@ -683,7 +681,7 @@ function BaseSelectionList<TItem extends ListItem>(
683681
)}
684682
{!!headerContent && headerContent}
685683
{flattenedSections.allOptions.length === 0 && showLoadingPlaceholder ? (
686-
getSkeletonView()
684+
<OptionsListSkeletonView isUserList={shouldUseUserSkeletonView} />
687685
) : (
688686
<>
689687
{!listHeaderContent && header()}

src/components/SelectionList/types.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ type BaseSelectionListProps<TItem extends ListItem> = Partial<ChildrenProps> & {
271271
/** Default renderer for every item in the list */
272272
ListItem: ValidListItem;
273273

274-
SkeletonView?: React.FC<SkeletonViewProps>;
274+
shouldUseUserSkeletonView?: boolean;
275275

276276
/** Whether this is a multi-select list */
277277
canSelectMultiple?: boolean;

src/components/UserListSkeletonView.tsx

-40
This file was deleted.

src/pages/workspace/WorkspaceMembersPage.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import SelectionList from '@components/SelectionList';
2121
import TableListItem from '@components/SelectionList/TableListItem';
2222
import type {ListItem, SelectionListHandle} from '@components/SelectionList/types';
2323
import Text from '@components/Text';
24-
import UserListSkeletonView from '@components/UserListSkeletonView';
2524
import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentUserPersonalDetails';
2625
import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails';
2726
import useLocalize from '@hooks/useLocalize';
@@ -568,7 +567,7 @@ function WorkspaceMembersPage({personalDetails, invitedEmailsToAccountIDsDraft,
568567
canSelectMultiple={isPolicyAdmin}
569568
sections={[{data, isDisabled: false}]}
570569
ListItem={TableListItem}
571-
SkeletonView={UserListSkeletonView}
570+
shouldUseUserSkeletonView
572571
disableKeyboardShortcuts={removeMembersConfirmModalVisible}
573572
headerMessage={getHeaderMessage()}
574573
headerContent={!isSmallScreenWidth && getHeaderContent()}

0 commit comments

Comments
 (0)