Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32563130
D12596.1767349070.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D12596.1767349070.diff
View Options
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,15 @@
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 (
- <Button style={buttonStyle} onPress={onPress}>
+ <LoadableButton style={buttonStyle} onPress={onPress} isLoading={isLoading}>
<Icon
name={icon}
size={22}
@@ -65,7 +66,7 @@
style={styles.buttonIcon}
/>
<Text style={styles.buttonText}>{buttonText}</Text>
- </Button>
+ </LoadableButton>
);
}
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 @@
</Text>
<View style={styles.incomingFriendRequestButtonsContainer}>
<View style={styles.acceptFriendRequestButtonContainer}>
- <RelationshipButton type="accept" onPress={friendUser} />
+ <RelationshipButton
+ type="accept"
+ onPress={friendUser}
+ isLoading={isLoadingFriendUser}
+ />
</View>
<View style={styles.rejectFriendRequestButtonContainer}>
- <RelationshipButton type="reject" onPress={unfriendUser} />
+ <RelationshipButton
+ type="reject"
+ onPress={unfriendUser}
+ isLoading={isLoadingUnfriendUser}
+ />
</View>
</View>
</View>
@@ -106,18 +115,28 @@
) {
return (
<View style={styles.singleButtonContainer}>
- <RelationshipButton type="withdraw" onPress={unfriendUser} />
+ <RelationshipButton
+ type="withdraw"
+ onPress={unfriendUser}
+ isLoading={isLoadingUnfriendUser}
+ />
</View>
);
}
return (
<View style={styles.singleButtonContainer}>
- <RelationshipButton type="add" onPress={friendUser} />
+ <RelationshipButton
+ type="add"
+ onPress={friendUser}
+ isLoading={isLoadingFriendUser}
+ />
</View>
);
}, [
friendUser,
+ isLoadingFriendUser,
+ isLoadingUnfriendUser,
otherUserInfo,
styles.acceptFriendRequestButtonContainer,
styles.incomingFriendRequestButtonsContainer,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 2, 10:17 AM (7 h, 14 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5879189
Default Alt Text
D12596.1767349070.diff (4 KB)
Attached To
Mode
D12596: [native] introduce loading logic to relationship prompt button
Attached
Detach File
Event Timeline
Log In to Comment