diff --git a/assets/images/customEmoji/global-create.svg b/assets/images/customEmoji/global-create.svg
new file mode 100644
index 000000000000..60b46eb97aed
--- /dev/null
+++ b/assets/images/customEmoji/global-create.svg
@@ -0,0 +1,14 @@
+
+
+
diff --git a/src/CONST.ts b/src/CONST.ts
index a1f107426686..1ef16a86ba89 100755
--- a/src/CONST.ts
+++ b/src/CONST.ts
@@ -175,7 +175,7 @@ const onboardingEmployerOrSubmitMessage: OnboardingMessage = {
'\n' +
'Here’s how to submit an expense:\n' +
'\n' +
- '1. Click the green *+* button.\n' +
+ '1. Press the button.\n' +
'2. Choose *Create expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Add your reimburser to the request.\n' +
@@ -199,7 +199,7 @@ const combinedTrackSubmitOnboardingEmployerOrSubmitMessage: OnboardingMessage =
'\n' +
'Here’s how to submit an expense:\n' +
'\n' +
- '1. Click the green *+* button.\n' +
+ '1. Press the button.\n' +
'2. Choose *Create expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Add your reimburser to the request.\n' +
@@ -224,7 +224,7 @@ const onboardingPersonalSpendMessage: OnboardingMessage = {
'\n' +
'Here’s how to track an expense:\n' +
'\n' +
- '1. Click the green *+* button.\n' +
+ '1. Press the button.\n' +
'2. Choose *Create expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Choose your *personal* space.\n' +
@@ -248,7 +248,7 @@ const combinedTrackSubmitOnboardingPersonalSpendMessage: OnboardingMessage = {
'\n' +
'Here’s how to track an expense:\n' +
'\n' +
- '1. Click the green *+* button.\n' +
+ '1. Press the button.\n' +
'2. Choose *Create expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Choose your *personal* space.\n' +
@@ -5462,7 +5462,7 @@ const CONST = {
'\n' +
'Here’s how to start a chat:\n' +
'\n' +
- '1. Click the green *+* button.\n' +
+ '1. Press the button.\n' +
'2. Choose *Start chat*.\n' +
'3. Enter emails or phone numbers.\n' +
'\n' +
@@ -5480,7 +5480,7 @@ const CONST = {
'\n' +
'Here’s how to request money:\n' +
'\n' +
- '1. Click the green *+* button.\n' +
+ '1. Press the button.\n' +
'2. Choose *Start chat*.\n' +
'3. Enter any email, SMS, or name of who you want to split with.\n' +
'4. From within the chat, click the *+* button on the message bar, and click *Split expense*.\n' +
@@ -5516,7 +5516,7 @@ const CONST = {
'\n' +
'Here’s how to submit an expense:\n' +
'\n' +
- '1. Click the green *+* button.\n' +
+ '1. Press the button.\n' +
'2. Choose *Create expense*.\n' +
'3. Enter an amount or scan a receipt.\n' +
'4. Add your reimburser to the request.\n' +
diff --git a/src/components/FABPopoverProvider.tsx b/src/components/FABPopoverProvider.tsx
new file mode 100644
index 000000000000..ac018c77a9a9
--- /dev/null
+++ b/src/components/FABPopoverProvider.tsx
@@ -0,0 +1,133 @@
+import {useIsFocused} from '@react-navigation/native';
+import type {MutableRefObject, ReactNode} from 'react';
+import React, {createContext, useCallback, useMemo, useRef, useState} from 'react';
+import type {View} from 'react-native';
+import useResponsiveLayout from '@hooks/useResponsiveLayout';
+import getPlatform from '@libs/getPlatform';
+import FloatingActionButtonPopover from '@pages/home/sidebar/FloatingActionButtonPopover';
+import CONST from '@src/CONST';
+
+type FloatingActionButtonPopoverMenuRef = {
+ hideCreateMenu: () => void;
+};
+
+type FABPopoverContextValue = {
+ isCreateMenuActive: boolean;
+ hideCreateMenu: () => void;
+ toggleCreateMenu: (localFabRef: React.RefObject, localFabState: boolean) => void;
+ fabRef: MutableRefObject;
+};
+
+const FABPopoverContext = createContext({
+ isCreateMenuActive: false,
+ hideCreateMenu: () => {},
+ toggleCreateMenu: () => {},
+ fabRef: {current: null},
+});
+
+type FABPopoverProviderProps = {
+ children: ReactNode;
+};
+
+function FABPopoverProvider({children}: FABPopoverProviderProps) {
+ const [isCreateMenuActive, setIsCreateMenuActive] = useState(false);
+ const {shouldUseNarrowLayout} = useResponsiveLayout();
+ const fabRef = useRef(null);
+ const isFocused = useIsFocused();
+ const platform = getPlatform();
+
+ const popoverModal = useRef(null);
+
+ /**
+ * Method to hide popover when dragover.
+ */
+ const hidePopoverOnDragOver = useCallback(() => {
+ if (!popoverModal.current) {
+ return;
+ }
+ popoverModal.current.hideCreateMenu();
+ }, []);
+
+ /**
+ * Method create event listener
+ */
+ const createDragoverListener = () => {
+ if (platform !== CONST.PLATFORM.WEB) {
+ return;
+ }
+ document.addEventListener('dragover', hidePopoverOnDragOver);
+ };
+
+ /**
+ * Method remove event listener.
+ */
+ const removeDragoverListener = () => {
+ if (platform !== CONST.PLATFORM.WEB) {
+ return;
+ }
+ document.removeEventListener('dragover', hidePopoverOnDragOver);
+ };
+
+ /**
+ * Method called either when:
+ * - Pressing the floating action button to open the CreateMenu modal
+ * - Selecting an item on CreateMenu or closing it by clicking outside of the modal component
+ */
+ const hideCreateMenu = useCallback(
+ () => {
+ if (!isCreateMenuActive) {
+ return;
+ }
+ setIsCreateMenuActive(false);
+ removeDragoverListener();
+ },
+ // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
+ [isCreateMenuActive],
+ );
+
+ /**
+ * Method called when we click the floating action button
+ */
+ const showCreateMenu = useCallback(
+ () => {
+ if (!isFocused && shouldUseNarrowLayout) {
+ return;
+ }
+ setIsCreateMenuActive(true);
+ createDragoverListener();
+ },
+ // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
+ [isFocused, shouldUseNarrowLayout],
+ );
+
+ const toggleCreateMenu = useCallback(
+ (fab: React.RefObject, isFabActionActive: boolean) => {
+ fabRef.current = fab.current;
+ if (isFabActionActive) {
+ return hideCreateMenu();
+ }
+ return showCreateMenu();
+ },
+ [hideCreateMenu, showCreateMenu],
+ );
+
+ const value = useMemo(
+ () => ({
+ isCreateMenuActive,
+ hideCreateMenu,
+ toggleCreateMenu,
+ fabRef,
+ }),
+ [isCreateMenuActive, toggleCreateMenu, hideCreateMenu, fabRef],
+ );
+
+ return (
+
+
+ {children}
+
+ );
+}
+
+export default FABPopoverProvider;
+export {FABPopoverContext};
diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx
index c02054bf075c..a97a9e398402 100755
--- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx
+++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.tsx
@@ -89,6 +89,7 @@ function BaseHTMLEngineProvider({textSelectable = false, children, enableExperim
'mention-user': HTMLElementModel.fromCustomModel({tagName: 'mention-user', contentModel: HTMLContentModel.textual}),
'mention-report': HTMLElementModel.fromCustomModel({tagName: 'mention-report', contentModel: HTMLContentModel.textual}),
'mention-here': HTMLElementModel.fromCustomModel({tagName: 'mention-here', contentModel: HTMLContentModel.textual}),
+ 'custom-emoji': HTMLElementModel.fromCustomModel({tagName: 'custom-emoji', contentModel: HTMLContentModel.textual}),
'mention-short': HTMLElementModel.fromCustomModel({tagName: 'mention-short', contentModel: HTMLContentModel.textual}),
'next-step': HTMLElementModel.fromCustomModel({
tagName: 'next-step',
diff --git a/src/components/HTMLEngineProvider/CustomEmojiWithDefaultPressableAction.tsx b/src/components/HTMLEngineProvider/CustomEmojiWithDefaultPressableAction.tsx
new file mode 100644
index 000000000000..51bb6ba5ffc2
--- /dev/null
+++ b/src/components/HTMLEngineProvider/CustomEmojiWithDefaultPressableAction.tsx
@@ -0,0 +1,47 @@
+import type {ReactNode} from 'react';
+import React, {useContext, useEffect, useRef, useState} from 'react';
+import {FABPopoverContext} from '@components/FABPopoverProvider';
+import {PressableWithoutFeedback} from '@components/Pressable';
+import useLocalize from '@hooks/useLocalize';
+import useThemeStyles from '@hooks/useThemeStyles';
+import CONST from '@src/CONST';
+
+type CustomEmojiWithDefaultPressableActionProps = {
+ /* Key name identifying the emoji */
+ emojiKey: string;
+
+ /* Emoji content to render */
+ children: ReactNode;
+};
+
+function CustomEmojiWithDefaultPressableAction({emojiKey, children}: CustomEmojiWithDefaultPressableActionProps) {
+ const styles = useThemeStyles();
+ const {toggleCreateMenu, isCreateMenuActive} = useContext(FABPopoverContext);
+ const [isFabActionActive, setIsFabActionActive] = useState(isCreateMenuActive);
+ useEffect(() => {
+ setIsFabActionActive(isCreateMenuActive);
+ }, [isCreateMenuActive]);
+ const localFabRef = useRef(null);
+
+ const {translate} = useLocalize();
+
+ if (emojiKey === 'actionMenuIcon') {
+ return (
+ toggleCreateMenu(localFabRef, isFabActionActive)}
+ ref={localFabRef}
+ onLongPress={() => {}}
+ style={[styles.verticalAlignBottom, styles.userSelectNone]}
+ role={CONST.ROLE.BUTTON}
+ shouldUseHapticsOnLongPress={false}
+ accessibilityLabel={translate('sidebarScreen.fabNewChatExplained')}
+ >
+ {children}
+
+ );
+ }
+
+ return children;
+}
+
+export default CustomEmojiWithDefaultPressableAction;
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx
new file mode 100644
index 000000000000..3fc258ab94c3
--- /dev/null
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx
@@ -0,0 +1,42 @@
+import React from 'react';
+import type {FC} from 'react';
+import {View} from 'react-native';
+import type {CustomRendererProps, TPhrasing, TText} from 'react-native-render-html';
+import type {SvgProps} from 'react-native-svg';
+import GlobalCreateIcon from '@assets/images/customEmoji/global-create.svg';
+import CustomEmojiWithDefaultPressableAction from '@components/HTMLEngineProvider/CustomEmojiWithDefaultPressableAction';
+import ImageSVG from '@components/ImageSVG';
+import useThemeStyles from '@hooks/useThemeStyles';
+import variables from '@styles/variables';
+
+const emojiMap: Record> = {
+ actionMenuIcon: GlobalCreateIcon,
+};
+
+function CustomEmojiRenderer({tnode}: CustomRendererProps) {
+ const styles = useThemeStyles();
+ const emojiKey = tnode.attributes.emoji;
+
+ if (emojiMap[emojiKey]) {
+ const image = (
+
+
+
+ );
+
+ if ('pressablewithdefaultaction' in tnode.attributes) {
+ return {image};
+ }
+
+ return image;
+ }
+
+ return null;
+}
+
+export default CustomEmojiRenderer;
+export {emojiMap};
diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/index.ts b/src/components/HTMLEngineProvider/HTMLRenderers/index.ts
index 2ac2e8591915..54724bf76d15 100644
--- a/src/components/HTMLEngineProvider/HTMLRenderers/index.ts
+++ b/src/components/HTMLEngineProvider/HTMLRenderers/index.ts
@@ -1,6 +1,7 @@
import type {CustomTagRendererRecord} from 'react-native-render-html';
import AnchorRenderer from './AnchorRenderer';
import CodeRenderer from './CodeRenderer';
+import CustomEmojiRenderer from './CustomEmojiRenderer';
import DeletedActionRenderer from './DeletedActionRenderer';
import EditedRenderer from './EditedRenderer';
import EmojiRenderer from './EmojiRenderer';
@@ -38,6 +39,7 @@ const HTMLEngineProviderComponentList: CustomTagRendererRecord = {
'mention-user': MentionUserRenderer,
'mention-report': MentionReportRenderer,
'mention-here': MentionHereRenderer,
+ 'custom-emoji': CustomEmojiRenderer,
'mention-short': ShortMentionRenderer,
emoji: EmojiRenderer,
'next-step-email': NextStepEmailRenderer,
diff --git a/src/components/Navigation/BottomTabBar/index.tsx b/src/components/Navigation/BottomTabBar/index.tsx
index efbedba70d88..619643968231 100644
--- a/src/components/Navigation/BottomTabBar/index.tsx
+++ b/src/components/Navigation/BottomTabBar/index.tsx
@@ -1,7 +1,9 @@
-import React, {memo, useCallback, useEffect, useState} from 'react';
+import React, {memo, useCallback, useContext, useEffect, useRef, useState} from 'react';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import type {ValueOf} from 'type-fest';
+import {FABPopoverContext} from '@components/FABPopoverProvider';
+import FloatingActionButton from '@components/FloatingActionButton';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import DebugTabView from '@components/Navigation/DebugTabView';
@@ -27,7 +29,6 @@ import Navigation from '@navigation/Navigation';
import navigationRef from '@navigation/navigationRef';
import type {RootNavigatorParamList, SearchFullscreenNavigatorParamList, State, WorkspaceSplitNavigatorParamList} from '@navigation/types';
import BottomTabAvatar from '@pages/home/sidebar/BottomTabAvatar';
-import BottomTabBarFloatingActionButton from '@pages/home/sidebar/BottomTabBarFloatingActionButton';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import NAVIGATORS from '@src/NAVIGATORS';
@@ -42,6 +43,8 @@ type BottomTabBarProps = {
};
function BottomTabBar({selectedTab, isTooltipAllowed = false}: BottomTabBarProps) {
+ const {isCreateMenuActive, toggleCreateMenu} = useContext(FABPopoverContext);
+ const localFabRef = useRef(null);
const theme = useTheme();
const styles = useThemeStyles();
const {translate} = useLocalize();
@@ -58,6 +61,11 @@ function BottomTabBar({selectedTab, isTooltipAllowed = false}: BottomTabBarProps
CONST.PRODUCT_TRAINING_TOOLTIP_NAMES.BOTTOM_NAV_INBOX_TOOLTIP,
isTooltipAllowed && selectedTab !== BOTTOM_TABS.HOME,
);
+ const [isFabActionActive, setIsFabActionActive] = useState(isCreateMenuActive);
+ useEffect(() => {
+ setIsFabActionActive(isCreateMenuActive);
+ }, [isCreateMenuActive]);
+
useEffect(() => {
setChatTabBrickRoad(getChatTabBrickRoad(activeWorkspaceID, reports));
// We need to get a new brick road state when report actions are updated, otherwise we'll be showing an outdated brick road.
@@ -259,7 +267,14 @@ function BottomTabBar({selectedTab, isTooltipAllowed = false}: BottomTabBarProps
onPress={showSettingsPage}
/>
-
+ toggleCreateMenu(localFabRef, isFabActionActive)}
+ isTooltipAllowed={isTooltipAllowed}
+ />
>
diff --git a/src/libs/Navigation/NavigationRoot.tsx b/src/libs/Navigation/NavigationRoot.tsx
index 6b7a9cbd13b9..867e22734ea8 100644
--- a/src/libs/Navigation/NavigationRoot.tsx
+++ b/src/libs/Navigation/NavigationRoot.tsx
@@ -2,6 +2,7 @@ import type {NavigationState} from '@react-navigation/native';
import {DarkTheme, DefaultTheme, findFocusedRoute, NavigationContainer} from '@react-navigation/native';
import React, {useContext, useEffect, useMemo, useRef} from 'react';
import {useOnyx} from 'react-native-onyx';
+import FABPopoverProvider from '@components/FABPopoverProvider';
import {ScrollOffsetContext} from '@components/ScrollOffsetContextProvider';
import {usePlaybackContext} from '@components/VideoPlayerContexts/PlaybackContext';
import useCurrentReportID from '@hooks/useCurrentReportID';
@@ -231,7 +232,9 @@ function NavigationRoot({authenticated, lastVisitedPath, initialUrl, onReady}: N
enabled: false,
}}
>
-
+
+
+
);
}
diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts
index 2a2b36ceb3c7..380b5fa877c7 100644
--- a/src/libs/ReportUtils.ts
+++ b/src/libs/ReportUtils.ts
@@ -7046,6 +7046,7 @@ function buildOptimisticTaskReport(
policyID: string = CONST.POLICY.OWNER_EMAIL_FAKE,
notificationPreference: NotificationPreference = CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
mediaAttributes?: Record,
+ shouldEscapeText = true,
): OptimisticTaskReport {
const participants: Participants = {
[ownerAccountID]: {
@@ -7060,7 +7061,7 @@ function buildOptimisticTaskReport(
return {
reportID: generateReportID(),
reportName: getParsedComment(title ?? '', undefined, undefined, [...CONST.TASK_TITLE_DISABLED_RULES]),
- description: getParsedComment(description ?? '', {}, mediaAttributes),
+ description: getParsedComment(description ?? '', {shouldEscapeText}, mediaAttributes),
ownerAccountID,
participants,
managerID: assigneeAccountID,
@@ -9424,6 +9425,7 @@ function prepareOnboardingOnyxData(
targetChatPolicyID,
CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN,
task.mediaAttributes,
+ !['submitExpense', 'trackExpense', 'startChat', 'splitExpense'].includes(task.type),
);
const emailCreatingAction =
engagementChoice === CONST.ONBOARDING_CHOICES.MANAGE_TEAM ? allPersonalDetails?.[actorAccountID]?.login ?? CONST.EMAIL.CONCIERGE : CONST.EMAIL.CONCIERGE;
diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts
index 95b469b190e8..1a1faac87009 100644
--- a/src/libs/actions/Policy/Policy.ts
+++ b/src/libs/actions/Policy/Policy.ts
@@ -78,7 +78,7 @@ import * as PolicyUtils from '@libs/PolicyUtils';
import {goBackWhenEnableFeature, navigateToExpensifyCardPage} from '@libs/PolicyUtils';
import * as ReportUtils from '@libs/ReportUtils';
import {prepareOnboardingOnyxData} from '@libs/ReportUtils';
-import type {PolicySelector} from '@pages/home/sidebar/FloatingActionButtonAndPopover';
+import type {PolicySelector} from '@pages/home/sidebar/FloatingActionButtonPopover';
import * as PaymentMethods from '@userActions/PaymentMethods';
import * as PersistedRequests from '@userActions/PersistedRequests';
import {resolveEnableFeatureConflicts} from '@userActions/RequestConflictUtils';
diff --git a/src/pages/home/sidebar/BottomTabBarFloatingActionButton/index.native.tsx b/src/pages/home/sidebar/BottomTabBarFloatingActionButton/index.native.tsx
deleted file mode 100644
index a85dac28b81c..000000000000
--- a/src/pages/home/sidebar/BottomTabBarFloatingActionButton/index.native.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-import FloatingActionButtonAndPopover from '@pages/home/sidebar/FloatingActionButtonAndPopover';
-
-export default FloatingActionButtonAndPopover;
diff --git a/src/pages/home/sidebar/BottomTabBarFloatingActionButton/index.tsx b/src/pages/home/sidebar/BottomTabBarFloatingActionButton/index.tsx
deleted file mode 100644
index 9d2ca36e7c9e..000000000000
--- a/src/pages/home/sidebar/BottomTabBarFloatingActionButton/index.tsx
+++ /dev/null
@@ -1,46 +0,0 @@
-import React, {useCallback, useRef} from 'react';
-import FloatingActionButtonAndPopover from '@pages/home/sidebar/FloatingActionButtonAndPopover';
-import type FloatingActionButtonPopoverMenuRef from './types';
-
-type BottomTabBarFloatingActionButtonProps = {
- isTooltipAllowed: boolean;
-};
-
-function BottomTabBarFloatingActionButton({isTooltipAllowed}: BottomTabBarFloatingActionButtonProps) {
- const popoverModal = useRef(null);
-
- /**
- * Method to hide popover when dragover.
- */
- const hidePopoverOnDragOver = useCallback(() => {
- if (!popoverModal.current) {
- return;
- }
- popoverModal.current.hideCreateMenu();
- }, []);
-
- /**
- * Method create event listener
- */
- const createDragoverListener = () => {
- document.addEventListener('dragover', hidePopoverOnDragOver);
- };
-
- /**
- * Method remove event listener.
- */
- const removeDragoverListener = () => {
- document.removeEventListener('dragover', hidePopoverOnDragOver);
- };
-
- return (
-
- );
-}
-
-export default BottomTabBarFloatingActionButton;
diff --git a/src/pages/home/sidebar/BottomTabBarFloatingActionButton/types.ts b/src/pages/home/sidebar/BottomTabBarFloatingActionButton/types.ts
deleted file mode 100644
index e8fd03ee2adc..000000000000
--- a/src/pages/home/sidebar/BottomTabBarFloatingActionButton/types.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-type FloatingActionButtonPopoverMenuRef = {
- hideCreateMenu: () => void;
-};
-
-export default FloatingActionButtonPopoverMenuRef;
diff --git a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx b/src/pages/home/sidebar/FloatingActionButtonPopover.tsx
similarity index 91%
rename from src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx
rename to src/pages/home/sidebar/FloatingActionButtonPopover.tsx
index 985a490f5e3f..e0a1117b5619 100644
--- a/src/pages/home/sidebar/FloatingActionButtonAndPopover.tsx
+++ b/src/pages/home/sidebar/FloatingActionButtonPopover.tsx
@@ -3,14 +3,13 @@ import {useIsFocused} from '@react-navigation/native';
import {Str} from 'expensify-common';
import type {ImageContentFit} from 'expo-image';
import type {ForwardedRef} from 'react';
-import React, {forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react';
-import {View} from 'react-native';
+import React, {forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo, useState} from 'react';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import {useOnyx} from 'react-native-onyx';
import type {SvgProps} from 'react-native-svg';
import ConfirmModal from '@components/ConfirmModal';
import CustomStatusBarAndBackgroundContext from '@components/CustomStatusBarAndBackground/CustomStatusBarAndBackgroundContext';
-import FloatingActionButton from '@components/FloatingActionButton';
+import {FABPopoverContext} from '@components/FABPopoverProvider';
import * as Expensicons from '@components/Icon/Expensicons';
import type {PopoverMenuItem} from '@components/PopoverMenu';
import PopoverMenu from '@components/PopoverMenu';
@@ -59,18 +58,7 @@ import mapOnyxCollectionItems from '@src/utils/mapOnyxCollectionItems';
type PolicySelector = Pick;
-type FloatingActionButtonAndPopoverProps = {
- /* Callback function when the menu is shown */
- onShowCreateMenu?: () => void;
-
- /* Callback function before the menu is hidden */
- onHideCreateMenu?: () => void;
-
- /* If the tooltip is allowed to be shown */
- isTooltipAllowed: boolean;
-};
-
-type FloatingActionButtonAndPopoverRef = {
+type FloatingActionButtonPopoverRef = {
hideCreateMenu: () => void;
};
@@ -173,7 +161,7 @@ const getQuickActionTitle = (action: QuickActionName): TranslationPaths => {
* Responsible for rendering the {@link PopoverMenu}, and the accompanying
* FAB that can open or close the menu.
*/
-function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isTooltipAllowed}: FloatingActionButtonAndPopoverProps, ref: ForwardedRef) {
+function FloatingActionButtonPopover(_: unknown, ref: ForwardedRef) {
const styles = useThemeStyles();
const theme = useTheme();
const {translate} = useLocalize();
@@ -197,9 +185,8 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
const [allPolicies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {selector: (c) => mapOnyxCollectionItems(c, policySelector)});
const currentUserPersonalDetails = useCurrentUserPersonalDetails();
- const [isCreateMenuActive, setIsCreateMenuActive] = useState(false);
+ const {isCreateMenuActive, hideCreateMenu, fabRef} = useContext(FABPopoverContext);
const [modalVisible, setModalVisible] = useState(false);
- const fabRef = useRef(null);
const {windowHeight} = useWindowDimensions();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const isFocused = useIsFocused();
@@ -304,38 +291,6 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
[isFocused, prevIsFocused],
);
- /**
- * Method called when we click the floating action button
- */
- const showCreateMenu = useCallback(
- () => {
- if (!isFocused && shouldUseNarrowLayout) {
- return;
- }
- setIsCreateMenuActive(true);
- onShowCreateMenu?.();
- },
- // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
- [isFocused, shouldUseNarrowLayout],
- );
-
- /**
- * Method called either when:
- * - Pressing the floating action button to open the CreateMenu modal
- * - Selecting an item on CreateMenu or closing it by clicking outside of the modal component
- */
- const hideCreateMenu = useCallback(
- () => {
- if (!isCreateMenuActive) {
- return;
- }
- setIsCreateMenuActive(false);
- onHideCreateMenu?.();
- },
- // eslint-disable-next-line react-compiler/react-compiler, react-hooks/exhaustive-deps
- [isCreateMenuActive],
- );
-
useEffect(() => {
if (!didScreenBecomeInactive()) {
return;
@@ -351,14 +306,6 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
},
}));
- const toggleCreateMenu = () => {
- if (isCreateMenuActive) {
- hideCreateMenu();
- } else {
- showCreateMenu();
- }
- };
-
const expenseMenuItems = useMemo((): PopoverMenuItem[] => {
return [
{
@@ -610,11 +557,11 @@ function FloatingActionButtonAndPopover({onHideCreateMenu, onShowCreateMenu, isT
];
return (
-
+ <>
-
-
+ >
);
}
-FloatingActionButtonAndPopover.displayName = 'FloatingActionButtonAndPopover';
+FloatingActionButtonPopover.displayName = 'FloatingActionButtonPopover';
-export default forwardRef(FloatingActionButtonAndPopover);
+export default forwardRef(FloatingActionButtonPopover);
export type {PolicySelector};
diff --git a/src/styles/index.ts b/src/styles/index.ts
index 5cdeae416613..b510516ffb78 100644
--- a/src/styles/index.ts
+++ b/src/styles/index.ts
@@ -13,6 +13,7 @@ import type {ValueOf} from 'type-fest';
import type DotLottieAnimation from '@components/LottieAnimations/types';
import {ACTIVE_LABEL_SCALE} from '@components/TextInput/styleConst';
import {getBrowser, isMobile, isMobileSafari, isSafari} from '@libs/Browser';
+import getPlatform from '@libs/getPlatform';
import CONST from '@src/CONST';
import {defaultTheme} from './theme';
import colors from './theme/colors';
@@ -387,6 +388,9 @@ const styles = (theme: ThemeColors) =>
verticalAlignTop: {
verticalAlign: 'top',
},
+ verticalAlignBottom: {
+ verticalAlign: 'bottom',
+ },
lineHeightLarge: {
lineHeight: variables.lineHeightLarge,
},
@@ -1732,6 +1736,16 @@ const styles = (theme: ThemeColors) =>
justifyContent: 'center',
},
+ customEmoji: {
+ alignItems: 'center',
+ justifyContent: 'center',
+ verticalAlign: 'bottom',
+ ...(getPlatform() === CONST.PLATFORM.IOS ? {marginBottom: -variables.fontSizeNormalHeight / 4} : {}),
+ // `fontSizeNormal` value for scale factor 1 is 15
+ ...(getPlatform() === CONST.PLATFORM.ANDROID ? {marginBottom: -(variables.fontSizeEmojiNormal - 10)} : {}),
+ ...(getPlatform() === CONST.PLATFORM.ANDROID ? {marginRight: -(variables.fontSizeEmojiNormal - 15)} : {}),
+ },
+
sidebarFooterUsername: {
color: theme.heading,
fontSize: variables.fontSizeLabel,
diff --git a/src/styles/variables.ts b/src/styles/variables.ts
index 1ac61126d8c4..4a9833c88ab2 100644
--- a/src/styles/variables.ts
+++ b/src/styles/variables.ts
@@ -53,6 +53,7 @@ export default {
fontSizeExtraSmall: 9,
fontSizeLabel: getValueUsingPixelRatio(13, 19),
fontSizeNormal: getValueUsingPixelRatio(15, 21),
+ fontSizeEmojiNormal: getValueUsingPixelRatio(15, 28),
fontSizeMedium: getValueUsingPixelRatio(16, 22),
fontSizeLarge: getValueUsingPixelRatio(17, 19),
fontSizeHero: 36,