From 9753334ff20a96e9f5d4408cc8cc7edcde1359d7 Mon Sep 17 00:00:00 2001 From: Matthew Birtch Date: Fri, 23 Dec 2022 07:08:51 -0500 Subject: [PATCH] [Gekidou MM-46365] fix reaction bar space and update bottom sheet styles (#6634) * updated styles for reaction bar and made pick reaction pressable * removed unused style import * removed unused style import * updated user avatars, user presence, thread options bottom sheets to new style also * updated status bottom sheet, thread options, and some tweaks to the bottom sheet main file * fixed a few minor styling issues * used proper bottom inset in user presence bottom sheet * various updates to bottom sheets * used negative top position instead of negative margin * updated camera type bottom sheet * further refinements to bottom sheets * updates to emoji bar and profile image picker Co-authored-by: Elias Nahum --- app/components/option_item/index.tsx | 1 - .../camera_quick_action/camera_type.tsx | 96 +++++-------------- .../camera_quick_action/index.tsx | 12 ++- .../post_priority_picker/index.tsx | 2 +- app/components/user_avatars_stack/index.tsx | 15 ++- app/components/user_item/user_item.tsx | 4 +- app/constants/reaction_picker.ts | 2 +- app/screens/bottom_sheet/button.tsx | 4 +- app/screens/bottom_sheet/content.tsx | 5 +- app/screens/bottom_sheet/index.tsx | 9 +- .../components/custom_status_input.tsx | 2 +- app/screens/custom_status/index.tsx | 2 +- .../components/profile_image_picker.tsx | 26 ++++- .../custom_label/custom_status_text.tsx | 2 +- .../options/custom_status/index.tsx | 2 +- .../options/user_presence/index.tsx | 39 ++++++-- .../servers/servers_list/index.tsx | 2 +- .../servers_list/server_item/server_item.tsx | 1 + app/screens/home/search/results/filter.tsx | 3 +- .../reaction_bar/pick_reaction/index.tsx | 48 ++++++---- .../reaction_bar/reaction/index.tsx | 3 +- .../reaction_bar/reaction_bar.tsx | 6 +- app/screens/reactions/emoji_bar/index.tsx | 5 +- .../reactors_list/reactor/reactor.tsx | 6 ++ app/screens/thread_options/thread_options.tsx | 21 ++-- assets/base/i18n/en.json | 18 ++-- 26 files changed, 188 insertions(+), 148 deletions(-) diff --git a/app/components/option_item/index.tsx b/app/components/option_item/index.tsx index dfd8ea315..96a5a881b 100644 --- a/app/components/option_item/index.tsx +++ b/app/components/option_item/index.tsx @@ -283,7 +283,6 @@ const OptionItem = ({ } ); - if (Object.values(TouchableOptionTypes).includes(type)) { return ( diff --git a/app/components/post_draft/quick_actions/camera_quick_action/camera_type.tsx b/app/components/post_draft/quick_actions/camera_quick_action/camera_type.tsx index 411c4d594..c42eccb1d 100644 --- a/app/components/post_draft/quick_actions/camera_quick_action/camera_type.tsx +++ b/app/components/post_draft/quick_actions/camera_quick_action/camera_type.tsx @@ -2,60 +2,36 @@ // See LICENSE.txt for license information. import React from 'react'; +import {useIntl} from 'react-intl'; import {View} from 'react-native'; import {CameraOptions} from 'react-native-image-picker'; -import CompassIcon from '@components/compass_icon'; import FormattedText from '@components/formatted_text'; -import TouchableWithFeedback from '@components/touchable_with_feedback'; +import SlideUpPanelItem from '@components/slide_up_panel_item'; import {useTheme} from '@context/theme'; import {useIsTablet} from '@hooks/device'; import {dismissBottomSheet} from '@screens/navigation'; import {makeStyleSheetFromTheme} from '@utils/theme'; +import {typography} from '@utils/typography'; type Props = { onPress: (options: CameraOptions) => void; } const getStyle = makeStyleSheetFromTheme((theme: Theme) => ({ - center: { - alignItems: 'center', - }, - container: { - alignItems: 'center', - backgroundColor: theme.centerChannelBg, - height: 200, - paddingVertical: 10, - }, - flex: { - flex: 1, - }, - options: { - alignItems: 'center', - flex: 1, - flexDirection: 'row', - justifyContent: 'space-evenly', - width: '100%', - marginBottom: 50, - }, - optionContainer: { - alignItems: 'flex-start', - }, title: { color: theme.centerChannelColor, - fontSize: 18, - fontWeight: 'bold', - }, - text: { - color: theme.centerChannelColor, - fontSize: 15, + ...typography('Heading', 600, 'SemiBold'), + marginBottom: 8, }, + })); const CameraType = ({onPress}: Props) => { const theme = useTheme(); const isTablet = useIsTablet(); const style = getStyle(theme); + const intl = useIntl(); const onPhoto = async () => { const options: CameraOptions = { @@ -80,54 +56,26 @@ const CameraType = ({onPress}: Props) => { }; return ( - + {!isTablet && } - - - - - - - - - - - - - - - - - - + + ); }; diff --git a/app/components/post_draft/quick_actions/camera_quick_action/index.tsx b/app/components/post_draft/quick_actions/camera_quick_action/index.tsx index 2579bb6ad..35d24aeaa 100644 --- a/app/components/post_draft/quick_actions/camera_quick_action/index.tsx +++ b/app/components/post_draft/quick_actions/camera_quick_action/index.tsx @@ -5,14 +5,18 @@ import React, {useCallback} from 'react'; import {useIntl} from 'react-intl'; import {Alert, StyleSheet} from 'react-native'; import {CameraOptions} from 'react-native-image-picker'; +import {useSafeAreaInsets} from 'react-native-safe-area-context'; import CompassIcon from '@components/compass_icon'; +import {ITEM_HEIGHT} from '@components/slide_up_panel_item'; import TouchableWithFeedback from '@components/touchable_with_feedback'; import {ICON_SIZE} from '@constants/post_draft'; import {useTheme} from '@context/theme'; +import {TITLE_HEIGHT} from '@screens/bottom_sheet/content'; import {bottomSheet} from '@screens/navigation'; import {fileMaxWarning} from '@utils/file'; import PickerUtil from '@utils/file/file_picker'; +import {bottomSheetSnapPoint} from '@utils/helpers'; import {changeOpacity} from '@utils/theme'; import CameraType from './camera_type'; @@ -36,6 +40,7 @@ export default function CameraQuickAction({ }: QuickActionAttachmentProps) { const intl = useIntl(); const theme = useTheme(); + const {bottom} = useSafeAreaInsets(); const handleButtonPress = useCallback((options: CameraOptions) => { const picker = new PickerUtil(intl, @@ -64,14 +69,15 @@ export default function CameraQuickAction({ return; } + const snap = bottomSheetSnapPoint(2, ITEM_HEIGHT, bottom); bottomSheet({ - title: intl.formatMessage({id: 'camera_type.title', defaultMessage: 'Choose an action'}), + title: intl.formatMessage({id: 'mobile.camera_type.title', defaultMessage: 'Camera options'}), renderContent, - snapPoints: [200, 10], + snapPoints: [TITLE_HEIGHT + snap, 10], theme, closeButtonId: 'camera-close-id', }); - }, [intl, theme, renderContent, maxFilesReached, maxFileCount]); + }, [intl, theme, renderContent, maxFilesReached, maxFileCount, bottom]); const actionTestID = disabled ? `${testID}.disabled` : testID; const color = disabled ? changeOpacity(theme.centerChannelColor, 0.16) : changeOpacity(theme.centerChannelColor, 0.64); diff --git a/app/components/post_priority/post_priority_picker/index.tsx b/app/components/post_priority/post_priority_picker/index.tsx index 48c51e60a..5b70622b8 100644 --- a/app/components/post_priority/post_priority_picker/index.tsx +++ b/app/components/post_priority/post_priority_picker/index.tsx @@ -30,7 +30,7 @@ const getStyle = makeStyleSheetFromTheme((theme: Theme) => ({ }, title: { color: theme.centerChannelColor, - ...typography('Body', 600, 'SemiBold'), + ...typography('Heading', 600, 'SemiBold'), }, betaContainer: { backgroundColor: PostPriorityColors.IMPORTANT, diff --git a/app/components/user_avatars_stack/index.tsx b/app/components/user_avatars_stack/index.tsx index d2a43bc32..57199ba30 100644 --- a/app/components/user_avatars_stack/index.tsx +++ b/app/components/user_avatars_stack/index.tsx @@ -4,11 +4,14 @@ import React, {useCallback} from 'react'; import {useIntl} from 'react-intl'; import {StyleProp, Text, TouchableOpacity, View, ViewStyle} from 'react-native'; +import {useSafeAreaInsets} from 'react-native-safe-area-context'; import FormattedText from '@components/formatted_text'; import {useTheme} from '@context/theme'; import {useIsTablet} from '@hooks/device'; +import {TITLE_HEIGHT} from '@screens/bottom_sheet/content'; import {bottomSheet} from '@screens/navigation'; +import {bottomSheetSnapPoint} from '@utils/helpers'; import {preventDoubleTap} from '@utils/tap'; import {changeOpacity, makeStyleSheetFromTheme} from '@utils/theme'; import {typography} from '@utils/typography'; @@ -19,6 +22,7 @@ import UsersList from './users_list'; import type UserModel from '@typings/database/models/servers/user'; const OVERFLOW_DISPLAY_LIMIT = 99; +const USER_ROW_HEIGHT = 40; type Props = { channelId: string; @@ -88,9 +92,8 @@ const getStyleSheet = makeStyleSheetFromTheme((theme: Theme) => { marginBottom: 12, }, listHeaderText: { - color: changeOpacity(theme.centerChannelColor, 0.56), - ...typography('Body', 75, 'SemiBold'), - textTransform: 'uppercase', + color: theme.centerChannelColor, + ...typography('Heading', 600, 'SemiBold'), }, }; }); @@ -99,6 +102,7 @@ const UserAvatarsStack = ({breakAt = 3, channelId, location, style: baseContaine const theme = useTheme(); const intl = useIntl(); const isTablet = useIsTablet(); + const {bottom} = useSafeAreaInsets(); const showParticipantsList = useCallback(preventDoubleTap(() => { const renderContent = () => ( @@ -119,15 +123,16 @@ const UserAvatarsStack = ({breakAt = 3, channelId, location, style: baseContaine /> ); + const snap = bottomSheetSnapPoint(Math.min(users.length, 5), USER_ROW_HEIGHT, bottom); bottomSheet({ closeButtonId: 'close-set-user-status', renderContent, initialSnapIndex: 1, - snapPoints: ['90%', '50%', 10], + snapPoints: ['90%', TITLE_HEIGHT + snap, 10], title: intl.formatMessage({id: 'mobile.participants.header', defaultMessage: 'Thread Participants'}), theme, }); - }), [isTablet, theme, users, channelId, location]); + }), [isTablet, theme, users, channelId, location, bottom]); const displayUsers = users.slice(0, breakAt); const overflowUsersCount = Math.min(users.length - displayUsers.length, OVERFLOW_DISPLAY_LIMIT); diff --git a/app/components/user_item/user_item.tsx b/app/components/user_item/user_item.tsx index f73447fcf..a16e3a443 100644 --- a/app/components/user_item/user_item.tsx +++ b/app/components/user_item/user_item.tsx @@ -25,6 +25,7 @@ type AtMentionItemProps = { showFullName: boolean; testID?: string; isCustomStatusEnabled: boolean; + pictureContainerStyle?: StyleProp; } const getName = (user: UserProfile | UserModel | undefined, showFullName: boolean, isCurrentUser: boolean, intl: IntlShape) => { @@ -95,6 +96,7 @@ const UserItem = ({ showFullName, testID, isCustomStatusEnabled, + pictureContainerStyle, }: AtMentionItemProps) => { const theme = useTheme(); const style = getStyleFromTheme(theme); @@ -116,7 +118,7 @@ const UserItem = ({ style={[style.row, containerStyle]} testID={userItemTestId} > - + { }, separator: { height: 1, - right: 16, + right: 20, borderTopWidth: 1, borderColor: changeOpacity(theme.centerChannelColor, 0.08), + marginBottom: 20, }, }; }); @@ -83,7 +84,7 @@ const BottomSheetContent = ({buttonText, buttonIcon, children, disableButton, on {showButton && ( <> - +