-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[TS migration] Migrate HTMLRenderers components #35462
Merged
techievivek
merged 13 commits into
Expensify:main
from
ruben-rebelo:ts-migration/HTMLRenderers
Feb 9, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
170ae46
[TS migration] HTMLRenderers components migration
ruben-rebelo 90bd42a
[TS migration] Code improvements
ruben-rebelo 66461db
[TS migration] Addressed suggestions HTMLRenderers
ruben-rebelo 5b7cd2b
[TS migration] HTMLRenderers prettified
ruben-rebelo 42cbbd5
[TS migration] HTMLRenderers applied code suggestion
ruben-rebelo 7164056
[TS migration] Comment style
ruben-rebelo 3b36267
[TS migration] HTMLRenderers better check for typesafety
ruben-rebelo a068c0c
[TS migration] Fixed issues after merge with master
ruben-rebelo 2e0f786
[TS migration] Lint fixes
ruben-rebelo 61fc9c6
[TS migration][HTMlRenderers] After merge code changes
ruben-rebelo fbafb0f
Merge branch 'main' into ts-migration/HTMLRenderers
ruben-rebelo 5c7dbb8
Merge branch 'main' into ts-migration/HTMLRenderers
ruben-rebelo 54821c2
Merge branch 'main' into ts-migration/HTMLRenderers
ruben-rebelo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✋ Coming from #36349
We seem to have messed out the style because the props position changed.