diff --git a/native/components/relationship-button.react.js b/native/components/relationship-button.react.js --- a/native/components/relationship-button.react.js +++ b/native/components/relationship-button.react.js @@ -4,7 +4,7 @@ import * as React from 'react'; import { Text } from 'react-native'; -import Button from './button.react.js'; +import LoadableButton from './loadable-button.react.js'; import { useStyles, useColors } from '../themes/colors.js'; type RelationshipButtonType = @@ -18,10 +18,11 @@ type Props = { +type: RelationshipButtonType, +onPress: () => mixed, + +isLoading: boolean, }; function RelationshipButton(props: Props): React.Node { - const { type, onPress } = props; + const { type, onPress, isLoading } = props; const styles = useStyles(unboundStyles); const colors = useColors(); @@ -38,10 +39,10 @@ return result; }, [styles.buttonContainer, styles.greenButton, styles.redButton, type]); - let buttonText = 'Add Friend'; + let buttonText = 'Add friend'; let icon = 'user-plus'; if (type === 'withdraw') { - buttonText = 'Withdraw Friend Request'; + buttonText = 'Withdraw friend request'; icon = 'user-minus'; } else if (type === 'accept') { buttonText = 'Accept'; @@ -49,15 +50,14 @@ buttonText = 'Reject'; icon = 'user-minus'; } else if (type === 'block') { - buttonText = 'Block User'; + buttonText = 'Block user'; icon = 'user-shield'; } else if (type === 'unblock') { - buttonText = 'Unblock User'; + buttonText = 'Unblock user'; icon = 'user-shield'; } - return ( - + ); } 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 @@ -39,6 +39,7 @@ const { otherUserInfo, callbacks: { friendUser, unfriendUser }, + loadingState: { isLoadingFriendUser, isLoadingUnfriendUser }, } = useRelationshipPrompt( threadInfo, onErrorCallback, @@ -91,10 +92,18 @@ - + - + @@ -106,18 +115,28 @@ ) { return ( - + ); } return ( - + ); }, [ friendUser, + isLoadingFriendUser, + isLoadingUnfriendUser, otherUserInfo, styles.acceptFriendRequestButtonContainer, styles.incomingFriendRequestButtonsContainer,