-
Notifications
You must be signed in to change notification settings - Fork 4k
Add clickable custom emoji support for onboarding task #55222
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
Merged
carlosmiceli
merged 14 commits into
Expensify:main
from
Amoralchik:clickable-emoji-in-expense-task
Jan 31, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c446d64
Add custom emoji functionality and for onboarding task
Amoralchik 238cfa8
Add GlobalCreate svg and update FloatingActionButton to use it
Amoralchik 897fcde
Merge remote-tracking branch 'origin/main' into clickable-emoji-in-ex…
Amoralchik b1e3dbc
Fix FloatingActionButton emoji styles for ios and android
Amoralchik 1fb883d
Merge remote-tracking branch 'origin/main' into clickable-emoji-in-ex…
Amoralchik 885da3e
Fix FloatingActionButton emoji position
Amoralchik 4a1e6fe
Refactor custom emoji handling via FABProvider
Amoralchik 4686987
Fix emoji position for non-web platforms in CustomEmoji components
Amoralchik ee33234
Merge remote-tracking branch 'origin/main' into clickable-emoji-in-ex…
Amoralchik b313b5e
refactor CustomEmojiWithDefaultPressableAction to use FloatingActionB…
Amoralchik 8d43075
Merge remote-tracking branch 'origin/main' into clickable-emoji-in-ex…
Amoralchik 6defcc7
refactor CustomEmojiWithDefaultPressableAction to accept children for…
Amoralchik 60d06bf
refactor emoji keys in onboarding messages and components according t…
Amoralchik f14215e
refactor FloatingActionButtonAndPopover to remove platform-specific s…
Amoralchik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/components/HTMLEngineProvider/CustomEmojiWithDefaultPressableAction.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 === 'actionMenuIcon') { | ||
| return <FloatingActionButtonAndPopover isEmoji>{children}</FloatingActionButtonAndPopover>; | ||
| } | ||
|
|
||
| return children; | ||
| } | ||
|
|
||
| export default CustomEmojiWithDefaultPressableAction; |
42 changes: 42 additions & 0 deletions
42
src/components/HTMLEngineProvider/HTMLRenderers/CustomEmojiRenderer.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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<string, FC<SvgProps>> = { | ||
| actionMenuIcon: GlobalCreateIcon, | ||
| }; | ||
|
|
||
| function CustomEmojiRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) { | ||
| const styles = useThemeStyles(); | ||
| const emojiKey = tnode.attributes.emoji; | ||
|
|
||
| if (emojiMap[emojiKey]) { | ||
| const image = ( | ||
| <View style={styles.customEmoji}> | ||
| <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; | ||
| export {emojiMap}; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.