Page MenuHomePhabricator

D7622.id25746.diff
No OneTemporary

D7622.id25746.diff

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,5 +1,6 @@
// @flow
+import { useNavigation } from '@react-navigation/native';
import invariant from 'invariant';
import * as React from 'react';
import { ActivityIndicator, TouchableOpacity, View } from 'react-native';
@@ -11,17 +12,17 @@
import EditAvatarBadge from './edit-avatar-badge.react.js';
import { EditUserAvatarContext } from './edit-user-avatar-provider.react.js';
import UserAvatar from './user-avatar.react.js';
+import { EmojiUserAvatarCreationRouteName } from '../navigation/route-names.js';
import { useSelector } from '../redux/redux-utils.js';
import { useStyles } from '../themes/colors.js';
type Props = {
+userID: ?string,
- +onPressEmojiAvatarFlow: () => mixed,
+disabled?: boolean,
};
function EditUserAvatar(props: Props): React.Node {
const styles = useStyles(unboundStyles);
- const { userID, onPressEmojiAvatarFlow, disabled } = props;
+ const { userID, disabled } = props;
const editUserAvatarContext = React.useContext(EditUserAvatarContext);
invariant(editUserAvatarContext, 'editUserAvatarContext should be set');
@@ -39,9 +40,14 @@
);
const ensAvatarURI = useENSAvatar(ethAddress);
+ const { navigate } = useNavigation();
+ const navigateToUserEmojiAvatarCreation = React.useCallback(() => {
+ navigate(EmojiUserAvatarCreationRouteName);
+ }, [navigate]);
+
const actionSheetConfig = React.useMemo(() => {
const configOptions = [
- { id: 'emoji', onPress: onPressEmojiAvatarFlow },
+ { id: 'emoji', onPress: navigateToUserEmojiAvatarCreation },
{ id: 'image', onPress: selectFromGalleryAndUpdateUserAvatar },
];
@@ -54,7 +60,7 @@
return configOptions;
}, [
ensAvatarURI,
- onPressEmojiAvatarFlow,
+ navigateToUserEmojiAvatarCreation,
removeUserAvatar,
setENSUserAvatar,
selectFromGalleryAndUpdateUserAvatar,
diff --git a/native/profile/profile-screen.react.js b/native/profile/profile-screen.react.js
--- a/native/profile/profile-screen.react.js
+++ b/native/profile/profile-screen.react.js
@@ -27,7 +27,6 @@
import type { NavigationRoute } from '../navigation/route-names.js';
import {
EditPasswordRouteName,
- EmojiUserAvatarCreationRouteName,
DeleteAccountRouteName,
BuildInfoRouteName,
DevToolsRouteName,
@@ -130,10 +129,7 @@
<View
style={[this.props.styles.section, this.props.styles.avatarSection]}
>
- <EditUserAvatar
- onPressEmojiAvatarFlow={this.onPressEmojiAvatarFlow}
- userID={this.props.currentUserInfo?.id}
- />
+ <EditUserAvatar userID={this.props.currentUserInfo?.id} />
</View>
</>
);
@@ -193,10 +189,6 @@
);
}
- onPressEmojiAvatarFlow = () => {
- this.props.navigation.navigate(EmojiUserAvatarCreationRouteName);
- };
-
onPressLogOut = () => {
if (this.loggedOutOrLoggingOut) {
return;

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 9, 3:26 AM (5 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2822474
Default Alt Text
D7622.id25746.diff (3 KB)

Event Timeline