Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3359512
D7529.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7529.diff
View Options
diff --git a/native/avatars/edit-user-avatar.react.js b/native/avatars/edit-user-avatar.react.js
--- a/native/avatars/edit-user-avatar.react.js
+++ b/native/avatars/edit-user-avatar.react.js
@@ -1,7 +1,7 @@
// @flow
import * as React from 'react';
-import { TouchableOpacity } from 'react-native';
+import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
import {
useRemoveUserAvatar,
@@ -10,6 +10,7 @@
} from './avatar-hooks.js';
import EditAvatarBadge from './edit-avatar-badge.react.js';
import UserAvatar from './user-avatar.react.js';
+import { useStyles } from '../themes/colors.js';
type Props = {
+userID: ?string,
@@ -17,12 +18,16 @@
+disabled?: boolean,
};
function EditUserAvatar(props: Props): React.Node {
+ const styles = useStyles(unboundStyles);
const { userID, onPressEmojiAvatarFlow, disabled } = props;
- const [selectFromGalleryAndUpdateUserAvatar] =
+ const [selectFromGalleryAndUpdateUserAvatar, isGalleryAvatarUpdateLoading] =
useSelectFromGalleryAndUpdateUserAvatar();
- const [removeUserAvatar] = useRemoveUserAvatar();
+ const [removeUserAvatar, isRemoveAvatarUpdateLoading] = useRemoveUserAvatar();
+
+ const isAvatarUpdateInProgress =
+ isGalleryAvatarUpdateLoading || isRemoveAvatarUpdateLoading;
const actionSheetConfig = React.useMemo(
() => [
@@ -39,12 +44,34 @@
const showAvatarActionSheet = useShowAvatarActionSheet(actionSheetConfig);
+ let spinner;
+ if (isAvatarUpdateInProgress) {
+ spinner = (
+ <View style={styles.spinnerContainer}>
+ <ActivityIndicator color="white" size="large" />
+ </View>
+ );
+ }
+
return (
<TouchableOpacity onPress={showAvatarActionSheet} disabled={disabled}>
<UserAvatar userID={userID} size="profile" />
+ {spinner}
{!disabled ? <EditAvatarBadge /> : null}
</TouchableOpacity>
);
}
+const unboundStyles = {
+ spinnerContainer: {
+ position: 'absolute',
+ alignItems: 'center',
+ justifyContent: 'center',
+ top: 0,
+ bottom: 0,
+ left: 0,
+ right: 0,
+ },
+};
+
export default EditUserAvatar;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 9:30 AM (21 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2579193
Default Alt Text
D7529.diff (2 KB)
Attached To
Mode
D7529: [native] Show `ActivityIndicator` in `EditUserAvatar` during update
Attached
Detach File
Event Timeline
Log In to Comment