diff --git a/src/components/CurrentUserPersonalDetailsSkeletonView/index.js b/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx similarity index 71% rename from src/components/CurrentUserPersonalDetailsSkeletonView/index.js rename to src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx index d56153cce1d3..3a87702b48e4 100644 --- a/src/components/CurrentUserPersonalDetailsSkeletonView/index.js +++ b/src/components/CurrentUserPersonalDetailsSkeletonView/index.tsx @@ -1,8 +1,7 @@ -import PropTypes from 'prop-types'; import React from 'react'; import {View} from 'react-native'; import {Circle, Rect} from 'react-native-svg'; -import _ from 'underscore'; +import {ValueOf} from 'type-fest'; import SkeletonViewContentLoader from '@components/SkeletonViewContentLoader'; import styles from '@styles/styles'; import * as StyleUtils from '@styles/StyleUtils'; @@ -10,29 +9,27 @@ import themeColors from '@styles/themes/default'; import variables from '@styles/variables'; import CONST from '@src/CONST'; -const propTypes = { +type CurrentUserPersonalDetailsSkeletonViewProps = { /** Whether to animate the skeleton view */ - shouldAnimate: PropTypes.bool, + shouldAnimate?: boolean; /** The size of the avatar */ - avatarSize: PropTypes.oneOf(_.values(CONST.AVATAR_SIZE)), + avatarSize?: ValueOf; /** Background color of the skeleton view */ - backgroundColor: PropTypes.string, + backgroundColor?: string; /** Foreground color of the skeleton view */ - foregroundColor: PropTypes.string, + foregroundColor?: string; }; -const defaultProps = { - shouldAnimate: true, - avatarSize: CONST.AVATAR_SIZE.LARGE, - backgroundColor: themeColors.highlightBG, - foregroundColor: themeColors.border, -}; - -function CurrentUserPersonalDetailsSkeletonView(props) { - const avatarPlaceholderSize = StyleUtils.getAvatarSize(props.avatarSize); +function CurrentUserPersonalDetailsSkeletonView({ + shouldAnimate = true, + avatarSize = CONST.AVATAR_SIZE.LARGE, + backgroundColor = themeColors.highlightBG, + foregroundColor = themeColors.border, +}: CurrentUserPersonalDetailsSkeletonViewProps) { + const avatarPlaceholderSize = StyleUtils.getAvatarSize(avatarSize); const avatarPlaceholderRadius = avatarPlaceholderSize / 2; const spaceBetweenAvatarAndHeadline = styles.mb3.marginBottom + styles.mt1.marginTop + (variables.lineHeightXXLarge - variables.fontSizeXLarge) / 2; const headlineSize = variables.fontSizeXLarge; @@ -41,9 +38,9 @@ function CurrentUserPersonalDetailsSkeletonView(props) { return (