Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3708894
D7622.id25746.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D7622.id25746.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,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
Details
Attached
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)
Attached To
Mode
D7622: [native] move navigate to emoji user avatar creation function to be within edit user avatar
Attached
Detach File
Event Timeline
Log In to Comment