diff --git a/app/components/selected_users/index.tsx b/app/components/selected_users/index.tsx index feac09143c..aa1522819a 100644 --- a/app/components/selected_users/index.tsx +++ b/app/components/selected_users/index.tsx @@ -150,6 +150,7 @@ export default function SelectedUsers({ const [isVisible, setIsVisible] = useState(false); const numberSelectedIds = Object.keys(selectedIds).length; const bottomSpace = (dimensions.height - containerHeight - modalPosition); + const bottomPaddingBottom = isTablet ? CHIP_HEIGHT_WITH_MARGIN : 0; const users = useMemo(() => { const u = []; @@ -172,8 +173,8 @@ export default function SelectedUsers({ }, [selectedIds, teammateNameDisplay, onRemove]); const totalPanelHeight = useDerivedValue(() => ( - isVisible ? panelHeight.value + BUTTON_HEIGHT : 0 - ), [isVisible, isTablet]); + isVisible ? panelHeight.value + BUTTON_HEIGHT + bottomPaddingBottom : 0 + ), [isVisible, isTablet, bottomPaddingBottom]); const marginBottom = useMemo(() => { let margin = keyboard.height && Platform.OS === 'ios' ? keyboard.height - insets.bottom : 0; @@ -208,7 +209,7 @@ export default function SelectedUsers({ }, [onPress]); const onLayout = useCallback((e: LayoutChangeEvent) => { - panelHeight.value = Math.min(PANEL_MAX_HEIGHT, e.nativeEvent.layout.height); + panelHeight.value = Math.min(PANEL_MAX_HEIGHT + bottomPaddingBottom, e.nativeEvent.layout.height); }, []); const androidMaxHeight = Platform.select({ @@ -235,8 +236,8 @@ export default function SelectedUsers({ const animatedViewStyle = useAnimatedStyle(() => ({ height: withTiming(totalPanelHeight.value + insets.bottom, {duration: 250}), borderWidth: isVisible ? 1 : 0, - maxHeight: isVisible ? PANEL_MAX_HEIGHT + BUTTON_HEIGHT + insets.bottom : 0, - }), [isVisible, insets]); + maxHeight: isVisible ? PANEL_MAX_HEIGHT + BUTTON_HEIGHT + bottomPaddingBottom + insets.bottom : 0, + }), [isVisible, insets, bottomPaddingBottom]); const animatedButtonStyle = useAnimatedStyle(() => ({ opacity: withTiming(isVisible ? 1 : 0, {duration: isVisible ? 500 : 100}), diff --git a/app/screens/create_direct_message/create_direct_message.tsx b/app/screens/create_direct_message/create_direct_message.tsx index ca540b9579..63f8cb66b8 100644 --- a/app/screens/create_direct_message/create_direct_message.tsx +++ b/app/screens/create_direct_message/create_direct_message.tsx @@ -197,8 +197,8 @@ export default function CreateDirectMessage({ setSelectedIds((current) => removeProfileFromList(current, id)); }, []); - const createDirectChannel = useCallback(async (id: string): Promise => { - const user = selectedIds[id]; + const createDirectChannel = useCallback(async (id: string, selectedUser?: UserProfile): Promise => { + const user = selectedUser || selectedIds[id]; const displayName = displayUsername(user, intl.locale, teammateNameDisplay); const result = await makeDirectChannel(serverUrl, id, displayName); @@ -219,7 +219,7 @@ export default function CreateDirectMessage({ return !result.error; }, [serverUrl]); - const startConversation = useCallback(async (selectedId?: {[id: string]: boolean}) => { + const startConversation = useCallback(async (selectedId?: {[id: string]: boolean}, selectedUser?: UserProfile) => { if (startingConversation) { return; } @@ -233,7 +233,7 @@ export default function CreateDirectMessage({ } else if (idsToUse.length > 1) { success = await createGroupChannel(idsToUse); } else { - success = await createDirectChannel(idsToUse[0]); + success = await createDirectChannel(idsToUse[0], selectedUser); } if (success) { @@ -249,7 +249,7 @@ export default function CreateDirectMessage({ [currentUserId]: true, }; - startConversation(selectedId); + startConversation(selectedId, user); } else { clearSearch(); setSelectedIds((current) => {