-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Support textDecorationLine on <Text> components (#709) #1056
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
12ac2cb
feat(WPF) Support textDecorationLine on <Text> components (#709)
ymusiychuk-lohika 5de9c8e
Underline implementation for UWP
ymusiychuk-lohika b4a8fe2
Removed reference to System.Runtime.Serialization
ymusiychuk-lohika bdc0a98
Styling fixes
ymusiychuk-lohika c4b93d3
Returned back System.Serialization
ymusiychuk-lohika 27f7ce1
Style changes
ymusiychuk-lohika fdbb0ec
Removed ChakraCore directory
ymusiychuk-lohika c05a80e
Merge branch 'master' into textDecorationLine-support-709
matthargett 5b5aa6b
Merge branch 'master' into textDecorationLine-support-709
matthargett 355182a
Small EnumHelpers reflection improvement
ymusiychuk-lohika f35c67a
Revert "Underline implementation for UWP"
ymusiychuk-lohika ced5687
Line endings fix
ymusiychuk-lohika 1db84ac
Merge branch 'master' into textDecorationLine-support-709
matthargett 5e842a0
Moved implementation from ShadowNode to TextViewManager and SpanViewM…
ymusiychuk-lohika e259858
Returned ReactTextShadowNode.cs to initial state
ymusiychuk-lohika 2e2f60e
Merge branch 'master' into textDecorationLine-support-709
matthargett 4850e9c
Merge branch 'master' into textDecorationLine-support-709
kevinvangelder 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
28 changes: 28 additions & 0 deletions
28
ReactWindows/ReactNative.Shared/Views/Text/TextDecorationLine.cs
This file contains hidden or 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,28 @@ | ||
| using System.Runtime.Serialization; | ||
|
|
||
| namespace ReactNative.Views.Text | ||
| { | ||
| /// <summary> | ||
| /// TextDecorationLine values. | ||
| /// </summary> | ||
| public enum TextDecorationLine | ||
| { | ||
| /// <summary> | ||
| /// Text has no line decoration. | ||
| /// </summary> | ||
| None, | ||
| /// <summary> | ||
| /// Text is Underlined. | ||
| /// </summary> | ||
| Underline, | ||
| /// <summary> | ||
| /// Text is Stroke out. | ||
| /// </summary> | ||
| LineThrough, | ||
| /// <summary> | ||
| /// Text is both Underlined and Stroke out. | ||
| /// </summary> | ||
| [EnumMember(Value = "underline line-through")] | ||
| UnderlineLineThrough | ||
| } | ||
| } | ||
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.
This is cool, this is compatible with the existing EnumHelpers class? We should re-write all the other enums to use this where possible. Ideally we could get rid of that reflection hack.
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.
We actually don't need this enum, you can just as easily switch case on the string itself.
In reply to: 104831419 [](ancestors = 104831419)
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.
That will avoid the dependency on System.Runtime.Serialization, and avoid the reflection driven changes to
EnumHelpersIn reply to: 104832645 [](ancestors = 104832645,104831419)
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.
I personally vote for enum instead of string, if there is a limited number of variants, because it
makes corresponding code strongly-typed.
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.
While I tend to agree that strong typing is usually good, I don't like that we have to add yet another dependency and pay an attribute reflection penalty for all enums across the framework just to support this strong typing.
In reply to: 105130501 [](ancestors = 105130501)
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.
When making decision on changing EnumHelpers I was looking onto "textAlign". Logically it is same as "textDecorationLine" and they both should be treated in same way. But "textDecorationLine" contains single value with space in it, which makes it impossible to use existing approach. So, either it must be an exceptional enum, treated differently (How many such enums can we possibly have?) or the approach should be changed. I've chosen the latter.
I am not against "switch" so if you insist, that's ok. But, please note, Reflection does not have "that" bad impact on performance if it happens once. Yes, if we have 100 000 of enums, then we will see the difference, but currently we have ~20 total and maybe it will grow up to 100 or 200 at most.