Skip to content
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

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {useContext} from 'react';
import {Platform} from 'react-native';
import {FABPopoverContext} from '@components/FABPopoverProvider';
import ImageSVG from '@components/ImageSVG';
import {PressableWithoutFeedback} from '@components/Pressable';
@@ -12,6 +13,7 @@ type CustomEmojiWithDefaultPressableActionProps = {

function CustomEmojiWithDefaultPressableAction({emojiKey}: CustomEmojiWithDefaultPressableActionProps) {
const styles = useThemeStyles();
const positionFix = Platform.OS !== 'web' && {height: '5%'};

const image = (
<ImageSVG
@@ -26,16 +28,12 @@ function CustomEmojiWithDefaultPressableAction({emojiKey}: CustomEmojiWithDefaul
return (
<PressableWithoutFeedback
onPress={() => setIsCreateMenuActive(!isCreateMenuActive)}
style={styles.customEmoji}
style={[styles.customEmoji, positionFix]}
accessible
accessibilityRole="button"
accessibilityLabel="Press to create a new item"
>
<ImageSVG
src={emojiMap[emojiKey]}
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}
/>
{image}
</PressableWithoutFeedback>
);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import type {FC} from 'react';
import {Platform} 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';
@@ -17,6 +18,7 @@ export const emojiMap: Record<string, FC<SvgProps>> = {
function CustomEmojiRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) {
const styles = useThemeStyles();
const emojiKey = tnode.attributes.emoji;
const positionFix = Platform.OS !== 'web' && {height: '5%'};
Copy link
Contributor

Choose a reason for hiding this comment

The 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 styles/index as specified below which completely removes positionFix. Please check this and see if it is preferable.


if (emojiMap[emojiKey]) {
if ('pressablewithdefaultaction' in tnode.attributes) {
@@ -25,7 +27,7 @@ function CustomEmojiRenderer({tnode}: CustomRendererProps<TText | TPhrasing>) {

return (
<ImageSVG
style={styles.customEmoji}
style={[styles.customEmoji, positionFix]}
src={emojiMap[emojiKey]}
width={variables.iconSizeNormal}
height={variables.iconSizeNormal}