-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:Expensify/App into stites-fixDateFo…
…rmatting
- Loading branch information
Showing
10 changed files
with
229 additions
and
104 deletions.
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 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 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 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 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 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 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 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.