forked from Expensify/App
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Expensify#35462 from ruben-rebelo/ts-migration/HTM…
…LRenderers [TS migration] Migrate HTMLRenderers components
- Loading branch information
Showing
17 changed files
with
208 additions
and
246 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
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
16 changes: 10 additions & 6 deletions
16
...ider/HTMLRenderers/MentionHereRenderer.js → ...der/HTMLRenderers/MentionHereRenderer.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 |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import React from 'react'; | ||
import type {TextStyle} from 'react-native'; | ||
import {StyleSheet} from 'react-native'; | ||
import type {CustomRendererProps, TPhrasing, TText} from 'react-native-render-html'; | ||
import {TNodeChildrenRenderer} from 'react-native-render-html'; | ||
import _ from 'underscore'; | ||
import Text from '@components/Text'; | ||
import useStyleUtils from '@hooks/useStyleUtils'; | ||
import htmlRendererPropTypes from './htmlRendererPropTypes'; | ||
|
||
function MentionHereRenderer(props) { | ||
function MentionHereRenderer({style, tnode}: CustomRendererProps<TText | TPhrasing>) { | ||
const StyleUtils = useStyleUtils(); | ||
|
||
const flattenStyle = StyleSheet.flatten(style as TextStyle); | ||
const {color, ...styleWithoutColor} = flattenStyle; | ||
|
||
return ( | ||
<Text> | ||
<Text | ||
// Passing the true value to the function as here mention is always for the current user | ||
color={StyleUtils.getMentionTextColor(true)} | ||
style={[_.omit(props.style, 'color'), StyleUtils.getMentionStyle(true)]} | ||
style={[styleWithoutColor, StyleUtils.getMentionStyle(true)]} | ||
> | ||
<TNodeChildrenRenderer tnode={props.tnode} /> | ||
<TNodeChildrenRenderer tnode={tnode} /> | ||
</Text> | ||
</Text> | ||
); | ||
} | ||
|
||
MentionHereRenderer.propTypes = htmlRendererPropTypes; | ||
MentionHereRenderer.displayName = 'HereMentionRenderer'; | ||
|
||
export default MentionHereRenderer; |
Oops, something went wrong.