diff --git a/native/user-profile/user-profile-constants.js b/native/user-profile/user-profile-constants.js new file mode 100644 --- /dev/null +++ b/native/user-profile/user-profile-constants.js @@ -0,0 +1,9 @@ +// @flow + +export const userProfileUserInfoContainerHeight = 90; + +export const userProfileBottomPadding = 40; + +export const userProfileMenuButtonHeight = 24; + +export const userProfileActionButtonHeight = 54; diff --git a/native/user-profile/user-profile-relationship-button.react.js b/native/user-profile/user-profile-relationship-button.react.js --- a/native/user-profile/user-profile-relationship-button.react.js +++ b/native/user-profile/user-profile-relationship-button.react.js @@ -9,6 +9,7 @@ import type { ThreadInfo } from 'lib/types/thread-types.js'; import type { UserInfo } from 'lib/types/user-types'; +import { userProfileActionButtonHeight } from './user-profile-constants.js'; import RelationshipButton from '../components/relationship-button.react.js'; import { useStyles } from '../themes/colors.js'; import Alert from '../utils/alert.js'; @@ -52,9 +53,7 @@ incomingFriendRequestButtonsContainerHeight, ); } else { - const relationshipButtonHeight = 54; - - setUserProfileRelationshipButtonHeight(relationshipButtonHeight); + setUserProfileRelationshipButtonHeight(userProfileActionButtonHeight); } }, [ otherUserInfo?.relationshipStatus, diff --git a/native/user-profile/user-profile.react.js b/native/user-profile/user-profile.react.js --- a/native/user-profile/user-profile.react.js +++ b/native/user-profile/user-profile.react.js @@ -12,6 +12,12 @@ import type { UserInfo } from 'lib/types/user-types'; import sleep from 'lib/utils/sleep.js'; +import { + userProfileUserInfoContainerHeight, + userProfileBottomPadding, + userProfileMenuButtonHeight, + userProfileActionButtonHeight, +} from './user-profile-constants.js'; import UserProfileMessageButton from './user-profile-message-button.react.js'; import UserProfileRelationshipButton from './user-profile-relationship-button.react.js'; import UserAvatar from '../avatars/user-avatar.react.js'; @@ -46,22 +52,22 @@ const insets = useSafeAreaInsets(); React.useLayoutEffect(() => { - const userInfoContainerHeight = 90; - const bottomPadding = 40; - - let height = insets.bottom + userInfoContainerHeight + bottomPadding; + let height = + insets.bottom + + userProfileUserInfoContainerHeight + + userProfileBottomPadding; if (userProfileThreadInfo) { - const menuButtonHeight = 24; - height += menuButtonHeight; + height += userProfileMenuButtonHeight; } if ( userProfileThreadInfo && !relationshipBlockedInEitherDirection(userInfo?.relationshipStatus) ) { - const messageButtonHeight = 54; - height += messageButtonHeight + userProfileRelationshipButtonHeight; + // message button height + relationship button height + height += + userProfileActionButtonHeight + userProfileRelationshipButtonHeight; } setContentHeight(height);