-
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 'Expensify:main' into fix-infinite-loading-when-navigate…
…d-before-plaid
- Loading branch information
Showing
26 changed files
with
165 additions
and
36 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
59 changes: 59 additions & 0 deletions
59
src/components/HTMLEngineProvider/HTMLRenderers/MentionUserRenderer.js
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,59 @@ | ||
import React from 'react'; | ||
import _ from 'underscore'; | ||
import { | ||
TNodeChildrenRenderer, | ||
} from 'react-native-render-html'; | ||
import Navigation from '../../../libs/Navigation/Navigation'; | ||
import ROUTES from '../../../ROUTES'; | ||
import Text from '../../Text'; | ||
import Tooltip from '../../Tooltip'; | ||
import htmlRendererPropTypes from './htmlRendererPropTypes'; | ||
import withCurrentUserPersonalDetails from '../../withCurrentUserPersonalDetails'; | ||
import personalDetailsPropType from '../../../pages/personalDetailsPropType'; | ||
import * as StyleUtils from '../../../styles/StyleUtils'; | ||
|
||
const propTypes = { | ||
...htmlRendererPropTypes, | ||
|
||
/** | ||
* Current user personal details | ||
*/ | ||
currentUserPersonalDetails: personalDetailsPropType.isRequired, | ||
}; | ||
|
||
/** | ||
* Navigates to user details screen based on email | ||
* @param {String} email | ||
* @returns {void} | ||
* */ | ||
const showUserDetails = email => Navigation.navigate(ROUTES.getDetailsRoute(email)); | ||
|
||
const MentionUserRenderer = (props) => { | ||
const defaultRendererProps = _.omit(props, ['TDefaultRenderer', 'style']); | ||
|
||
// We need to remove the leading @ from data as it is not part of the login | ||
const loginWhithoutLeadingAt = props.tnode.data.slice(1); | ||
|
||
const isOurMention = loginWhithoutLeadingAt === props.currentUserPersonalDetails.login; | ||
|
||
return ( | ||
<Text> | ||
<Tooltip absolute text={loginWhithoutLeadingAt}> | ||
<Text | ||
// eslint-disable-next-line react/jsx-props-no-spreading | ||
{...defaultRendererProps} | ||
color={StyleUtils.getUserMentionTextColor(isOurMention)} | ||
style={StyleUtils.getUserMentionStyle(isOurMention)} | ||
onPress={() => showUserDetails(loginWhithoutLeadingAt)} | ||
> | ||
<TNodeChildrenRenderer tnode={props.tnode} /> | ||
</Text> | ||
</Tooltip> | ||
</Text> | ||
); | ||
}; | ||
|
||
MentionUserRenderer.propTypes = propTypes; | ||
MentionUserRenderer.displayName = 'MentionUserRenderer'; | ||
|
||
export default withCurrentUserPersonalDetails(MentionUserRenderer); |
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
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
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.