Page MenuHomePhabricator

D7644.diff
No OneTemporary

D7644.diff

diff --git a/native/avatars/edit-thread-avatar.react.js b/native/avatars/edit-thread-avatar.react.js
--- a/native/avatars/edit-thread-avatar.react.js
+++ b/native/avatars/edit-thread-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';
@@ -10,16 +11,16 @@
import EditAvatarBadge from './edit-avatar-badge.react.js';
import { EditThreadAvatarContext } from './edit-thread-avatar-provider.react.js';
import ThreadAvatar from './thread-avatar.react.js';
+import { EmojiThreadAvatarCreationRouteName } from '../navigation/route-names.js';
import { useStyles } from '../themes/colors.js';
type Props = {
+threadInfo: RawThreadInfo | ThreadInfo,
- +onPressEmojiAvatarFlow: () => mixed,
+disabled?: boolean,
};
function EditThreadAvatar(props: Props): React.Node {
const styles = useStyles(unboundStyles);
- const { threadInfo, onPressEmojiAvatarFlow, disabled } = props;
+ const { threadInfo, disabled } = props;
const editThreadAvatarContext = React.useContext(EditThreadAvatarContext);
invariant(editThreadAvatarContext, 'editThreadAvatarContext should be set');
@@ -29,6 +30,18 @@
removeThreadAvatar,
} = editThreadAvatarContext;
+ const { navigate } = useNavigation();
+
+ const navigateToThreadEmojiAvatarCreation = React.useCallback(() => {
+ navigate<'EmojiThreadAvatarCreation'>({
+ name: EmojiThreadAvatarCreationRouteName,
+ params: {
+ threadID: threadInfo.id,
+ containingThreadID: threadInfo.containingThreadID,
+ },
+ });
+ }, [navigate, threadInfo.containingThreadID, threadInfo.id]);
+
const selectFromGallery = React.useCallback(
() => selectFromGalleryAndUpdateThreadAvatar(threadInfo.id),
[selectFromGalleryAndUpdateThreadAvatar, threadInfo.id],
@@ -41,11 +54,11 @@
const actionSheetConfig = React.useMemo(
() => [
- { id: 'emoji', onPress: onPressEmojiAvatarFlow },
+ { id: 'emoji', onPress: navigateToThreadEmojiAvatarCreation },
{ id: 'image', onPress: selectFromGallery },
{ id: 'remove', onPress: removeAvatar },
],
- [onPressEmojiAvatarFlow, removeAvatar, selectFromGallery],
+ [navigateToThreadEmojiAvatarCreation, removeAvatar, selectFromGallery],
);
const showAvatarActionSheet = useShowAvatarActionSheet(actionSheetConfig);
diff --git a/native/chat/settings/thread-settings-avatar.react.js b/native/chat/settings/thread-settings-avatar.react.js
--- a/native/chat/settings/thread-settings-avatar.react.js
+++ b/native/chat/settings/thread-settings-avatar.react.js
@@ -1,13 +1,11 @@
// @flow
-import { useNavigation } from '@react-navigation/native';
import * as React from 'react';
import { View } from 'react-native';
import { type ResolvedThreadInfo } from 'lib/types/thread-types.js';
import EditThreadAvatar from '../../avatars/edit-thread-avatar.react.js';
-import { EmojiThreadAvatarCreationRouteName } from '../../navigation/route-names.js';
import { useStyles } from '../../themes/colors.js';
type Props = {
@@ -17,27 +15,11 @@
function ThreadSettingsAvatar(props: Props): React.Node {
const { threadInfo, canChangeSettings } = props;
- const { navigate } = useNavigation();
-
const styles = useStyles(unboundStyles);
- const onPressEmojiAvatarFlow = React.useCallback(() => {
- navigate<'EmojiThreadAvatarCreation'>({
- name: EmojiThreadAvatarCreationRouteName,
- params: {
- threadID: threadInfo.id,
- containingThreadID: threadInfo.containingThreadID,
- },
- });
- }, [navigate, threadInfo.containingThreadID, threadInfo.id]);
-
return (
<View style={styles.container}>
- <EditThreadAvatar
- onPressEmojiAvatarFlow={onPressEmojiAvatarFlow}
- disabled={!canChangeSettings}
- threadInfo={threadInfo}
- />
+ <EditThreadAvatar disabled={!canChangeSettings} threadInfo={threadInfo} />
</View>
);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 29, 7:16 AM (9 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2731168
Default Alt Text
D7644.diff (3 KB)

Event Timeline