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 @@ -34,6 +34,18 @@ pendingPersonalThreadUserInfo, ); + const showNothing = + !otherUserInfo || + !otherUserInfo.username || + otherUserInfo.relationshipStatus === userRelationshipStatus.FRIEND; + + const showIncomingFriendRequestButtons = + otherUserInfo?.relationshipStatus === + userRelationshipStatus.REQUEST_RECEIVED; + + const showWithdrawFriendRequestButton = + otherUserInfo?.relationshipStatus === userRelationshipStatus.REQUEST_SENT; + const styles = useStyles(unboundStyles); const colors = useColors(); @@ -73,17 +85,11 @@ [styles.buttonContainer, styles.greenButton], ); - if ( - !otherUserInfo || - !otherUserInfo.username || - otherUserInfo.relationshipStatus === userRelationshipStatus.FRIEND - ) { + if (showNothing) { return null; } - if ( - otherUserInfo.relationshipStatus === userRelationshipStatus.REQUEST_RECEIVED - ) { + if (showIncomingFriendRequestButtons) { return ( @@ -114,9 +120,7 @@ ); } - if ( - otherUserInfo.relationshipStatus === userRelationshipStatus.REQUEST_SENT - ) { + if (showWithdrawFriendRequestButton) { return (