-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add clickable custom emoji support for onboarding task #55222
Changes from 12 commits
c446d64
238cfa8
897fcde
b1e3dbc
1fb883d
885da3e
4a1e6fe
4686987
ee33234
b313b5e
8d43075
6defcc7
60d06bf
f14215e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type {ReactNode} from 'react'; | ||
import React from 'react'; | ||
import FloatingActionButtonAndPopover from '@pages/home/sidebar/SidebarScreen/FloatingActionButtonAndPopover'; | ||
|
||
type CustomEmojiWithDefaultPressableActionProps = { | ||
/* Key name identifying the emoji */ | ||
emojiKey: string; | ||
|
||
/* Emoji content to render */ | ||
children: ReactNode; | ||
}; | ||
|
||
function CustomEmojiWithDefaultPressableAction({emojiKey, children}: CustomEmojiWithDefaultPressableActionProps) { | ||
if (emojiKey === 'action-menu-icon') { | ||
return <FloatingActionButtonAndPopover isEmoji>{children}</FloatingActionButtonAndPopover>; | ||
} | ||
|
||
return children; | ||
} | ||
|
||
export default CustomEmojiWithDefaultPressableAction; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,44 @@ | ||||||
import React from 'react'; | ||||||
import type {FC} from 'react'; | ||||||
import {Platform, 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'; | ||||||
|
||||||
// eslint-disable-next-line rulesdir/no-inline-named-export | ||||||
export const emojiMap: Record<string, FC<SvgProps>> = { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let us minimize the lint overrides
Suggested change
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||||||
'action-menu-icon': GlobalCreateIcon, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}; | ||||||
|
||||||
function CustomEmojiRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) { | ||||||
const styles = useThemeStyles(); | ||||||
const emojiKey = tnode.attributes.emoji; | ||||||
const positionFix = Platform.OS !== 'web' && {height: '5%'}; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not understand how restricting the height of the View moves its position on iOS. When I give a background color to the View with this styling the View appears very small and the image overflows but somehow it changes position. Can you please explain this? I have a suggestion using margin in |
||||||
|
||||||
if (emojiMap[emojiKey]) { | ||||||
const image = ( | ||||||
<View style={[styles.customEmoji, positionFix]}> | ||||||
<ImageSVG | ||||||
src={emojiMap[emojiKey]} | ||||||
width={variables.iconSizeNormal} | ||||||
height={variables.iconSizeNormal} | ||||||
/> | ||||||
</View> | ||||||
); | ||||||
|
||||||
if ('pressablewithdefaultaction' in tnode.attributes) { | ||||||
return <CustomEmojiWithDefaultPressableAction emojiKey={emojiKey}>{image}</CustomEmojiWithDefaultPressableAction>; | ||||||
} | ||||||
|
||||||
return image; | ||||||
} | ||||||
|
||||||
return null; | ||||||
} | ||||||
|
||||||
export default CustomEmojiRenderer; | ||||||
carlosmiceli marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -6412,6 +6412,7 @@ function buildOptimisticTaskReport( | |||||
description?: string, | ||||||
policyID: string = CONST.POLICY.OWNER_EMAIL_FAKE, | ||||||
notificationPreference: NotificationPreference = CONST.REPORT.NOTIFICATION_PREFERENCE.HIDDEN, | ||||||
shouldEscapeText?: boolean, | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
): OptimisticTaskReport { | ||||||
const participants: Participants = { | ||||||
[ownerAccountID]: { | ||||||
|
@@ -6426,7 +6427,7 @@ function buildOptimisticTaskReport( | |||||
return { | ||||||
reportID: generateReportID(), | ||||||
reportName: title, | ||||||
description: getParsedComment(description ?? ''), | ||||||
description: getParsedComment(description ?? '', {shouldEscapeText}), | ||||||
ownerAccountID, | ||||||
participants, | ||||||
managerID: assigneeAccountID, | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
pressablewithdefaultaction
is removed, it should render a non-interactive emoji. It is crashing for me for this case on web.Screen.Recording.2025-01-29.at.5.29.49.PM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this, I think I know why it happened
Additionally sorry, I did not make full testing, I pushed to pull and check the IOS on the laptop