-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8042 from mananjadhav/feat/ghost-screen
feat: Added Skeleton UI to chats
- Loading branch information
Showing
13 changed files
with
259 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/components/ReportActionsSkeletonView/SkeletonViewLines.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {Rect, Circle} from 'react-native-svg'; | ||
import SkeletonViewContentLoader from 'react-content-loader/native'; | ||
import CONST from '../../CONST'; | ||
|
||
const propTypes = { | ||
/** Number of rows to show in Skeleton UI block */ | ||
numberOfRows: PropTypes.number.isRequired, | ||
}; | ||
|
||
const SkeletonViewLines = props => ( | ||
<SkeletonViewContentLoader | ||
height={CONST.CHAT_SKELETON_VIEW.HEIGHT_FOR_ROW_COUNT[props.numberOfRows]} | ||
> | ||
<Circle cx="40" cy="26" r="20" /> | ||
<Rect x="67" y="11" width="20%" height="8" /> | ||
<Rect x="67" y="31" width="90%" height="8" /> | ||
{props.numberOfRows > 1 && <Rect x="67" y="51" width="50%" height="8" />} | ||
{props.numberOfRows > 2 && <Rect x="67" y="71" width="50%" height="8" />} | ||
</SkeletonViewContentLoader> | ||
); | ||
|
||
SkeletonViewLines.displayName = 'SkeletonViewLines'; | ||
SkeletonViewLines.propTypes = propTypes; | ||
export default SkeletonViewLines; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import SkeletonViewLines from './SkeletonViewLines'; | ||
import CONST from '../../CONST'; | ||
|
||
const propTypes = { | ||
/** Height of the container component */ | ||
containerHeight: PropTypes.number.isRequired, | ||
}; | ||
|
||
const ReportActionsSkeletonView = (props) => { | ||
// Determines the number of content items based on container height | ||
const possibleVisibleContentItems = Math.floor(props.containerHeight / CONST.CHAT_SKELETON_VIEW.AVERAGE_ROW_HEIGHT); | ||
const skeletonViewLines = []; | ||
for (let index = 0; index < possibleVisibleContentItems; index++) { | ||
const iconIndex = (index + 1) % 4; | ||
switch (iconIndex) { | ||
case 2: | ||
skeletonViewLines.push(<SkeletonViewLines numberOfRows={2} key={`skeletonViewLines${index}`} />); | ||
break; | ||
case 0: | ||
skeletonViewLines.push(<SkeletonViewLines numberOfRows={3} key={`skeletonViewLines${index}`} />); | ||
break; | ||
default: | ||
skeletonViewLines.push(<SkeletonViewLines numberOfRows={1} key={`skeletonViewLines${index}`} />); | ||
} | ||
} | ||
return <>{skeletonViewLines}</>; | ||
}; | ||
|
||
ReportActionsSkeletonView.displayName = 'ReportActionsSkeletonView'; | ||
ReportActionsSkeletonView.propTypes = propTypes; | ||
export default ReportActionsSkeletonView; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.