diff --git a/src/components/MenuItem.js b/src/components/MenuItem.js index bb4eeb7a18ac..268351699567 100644 --- a/src/components/MenuItem.js +++ b/src/components/MenuItem.js @@ -24,11 +24,7 @@ import variables from '../styles/variables'; import * as Session from '../libs/actions/Session'; import Hoverable from './Hoverable'; import useWindowDimensions from '../hooks/useWindowDimensions'; -import RenderHTML from './RenderHTML'; -import getPlatform from '../libs/getPlatform'; - -const platform = getPlatform(); -const isNative = platform === CONST.PLATFORM.IOS || platform === CONST.PLATFORM.ANDROID; +import MenuItemRenderHTMLTitle from './MenuItemRenderHTMLTitle'; const propTypes = menuItemPropTypes; @@ -251,16 +247,10 @@ const MenuItem = React.forwardRef((props, ref) => { )} - {Boolean(props.title) && - (Boolean(props.shouldRenderAsHTML) || (Boolean(props.shouldParseTitle) && Boolean(html.length))) && - (isNative ? ( - - ) : ( - - - - ))} - {!props.shouldRenderAsHTML && !html.length && Boolean(props.title) && ( + {Boolean(props.title) && (Boolean(props.shouldRenderAsHTML) || (Boolean(props.shouldParseTitle) && Boolean(html.length))) && ( + + )} + {!props.shouldRenderAsHTML && !props.shouldParseTitle && Boolean(props.title) && ( + + + ); +} + +MenuItemRenderHTMLTitle.propTypes = propTypes; +MenuItemRenderHTMLTitle.defaultProps = defaultProps; +MenuItemRenderHTMLTitle.displayName = 'MenuItemRenderHTMLTitle'; + +export default MenuItemRenderHTMLTitle; diff --git a/src/components/MenuItemRenderHTMLTitle/index.native.js b/src/components/MenuItemRenderHTMLTitle/index.native.js new file mode 100644 index 000000000000..b3dff8d77eff --- /dev/null +++ b/src/components/MenuItemRenderHTMLTitle/index.native.js @@ -0,0 +1,17 @@ +import React from 'react'; +import RenderHTML from '../RenderHTML'; +import menuItemRenderHTMLTitlePropTypes from './propTypes'; + +const propTypes = menuItemRenderHTMLTitlePropTypes; + +const defaultProps = {}; + +function MenuItemRenderHTMLTitle(props) { + return ; +} + +MenuItemRenderHTMLTitle.propTypes = propTypes; +MenuItemRenderHTMLTitle.defaultProps = defaultProps; +MenuItemRenderHTMLTitle.displayName = 'MenuItemRenderHTMLTitle'; + +export default MenuItemRenderHTMLTitle; diff --git a/src/components/MenuItemRenderHTMLTitle/propTypes.js b/src/components/MenuItemRenderHTMLTitle/propTypes.js new file mode 100644 index 000000000000..68e279eb28c3 --- /dev/null +++ b/src/components/MenuItemRenderHTMLTitle/propTypes.js @@ -0,0 +1,8 @@ +import PropTypes from 'prop-types'; + +const propTypes = { + /** Processed title to display for the MenuItem */ + title: PropTypes.string.isRequired, +}; + +export default propTypes; diff --git a/src/pages/tasks/NewTaskPage.js b/src/pages/tasks/NewTaskPage.js index 9fb600e40753..db63e01c4ce6 100644 --- a/src/pages/tasks/NewTaskPage.js +++ b/src/pages/tasks/NewTaskPage.js @@ -1,5 +1,5 @@ import React, {useEffect, useMemo, useState} from 'react'; -import {View} from 'react-native'; +import {ScrollView, View} from 'react-native'; import {withOnyx} from 'react-native-onyx'; import _ from 'underscore'; import PropTypes from 'prop-types'; @@ -149,50 +149,54 @@ function NewTaskPage(props) { Navigation.goBack(ROUTES.NEW_TASK_DETAILS); }} /> - - - Navigation.navigate(ROUTES.NEW_TASK_TITLE)} - shouldShowRightIcon - /> - Navigation.navigate(ROUTES.NEW_TASK_DESCRIPTION)} - shouldShowRightIcon - shouldParseTitle - numberOfLinesTitle={2} - titleStyle={styles.flex1} - /> - Navigation.navigate(ROUTES.NEW_TASK_ASSIGNEE)} - shouldShowRightIcon - /> - Navigation.navigate(ROUTES.NEW_TASK_SHARE_DESTINATION)} - interactive={!props.task.parentReportID} - shouldShowRightIcon={!props.task.parentReportID} + + + + Navigation.navigate(ROUTES.NEW_TASK_TITLE)} + shouldShowRightIcon + /> + Navigation.navigate(ROUTES.NEW_TASK_DESCRIPTION)} + shouldShowRightIcon + shouldParseTitle + numberOfLinesTitle={2} + titleStyle={styles.flex1} + /> + Navigation.navigate(ROUTES.NEW_TASK_ASSIGNEE)} + shouldShowRightIcon + /> + Navigation.navigate(ROUTES.NEW_TASK_SHARE_DESTINATION)} + interactive={!props.task.parentReportID} + shouldShowRightIcon={!props.task.parentReportID} + /> + + + + onSubmit()} + enabledWhenOffline + buttonText={props.translate('newTaskPage.confirmTask')} + containerStyles={[styles.mh0, styles.mt5, styles.flex1, styles.ph5]} /> - onSubmit()} - enabledWhenOffline - buttonText={props.translate('newTaskPage.confirmTask')} - containerStyles={[styles.mh0, styles.mt5, styles.flex1, styles.ph5]} - /> - + ); diff --git a/src/styles/styles.js b/src/styles/styles.js index a748a0fb353b..54df5b331690 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -1661,6 +1661,16 @@ const styles = (theme) => ({ ...wordBreak.breakWord, }, + renderHTMLTitle: { + color: theme.text, + fontSize: variables.fontSizeNormal, + fontFamily: fontFamily.EXP_NEUE, + lineHeight: variables.lineHeightXLarge, + maxWidth: '100%', + ...whiteSpace.preWrap, + ...wordBreak.breakWord, + }, + chatItemComposeWithFirstRow: { minHeight: 90, },