Skip to content

[Text] Add textDecoration style attributes - #845

Closed
KJlmfe wants to merge 6 commits into
react:masterfrom
KJlmfe:master
Closed

[Text] Add textDecoration style attributes#845
KJlmfe wants to merge 6 commits into
react:masterfrom
KJlmfe:master

Conversation

@KJlmfe

Copy link
Copy Markdown
Contributor

I add textDecorationLine, textDecorationStyle, textDecorationColor style property for Text module.

And it follows the CSS naming convention and using method is same with CSS.

  1. textDecorationLine refers to: https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-line
  2. textDecorationStyle refers to: https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-style
  3. textDecorationColorrefers to: https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-color

Here is a simple demo:

<Textstyle={{textDecorationLine: 'underline',textDecorationStyle: 'solid'}}>
Solid underline
</Text><Textstyle={{textDecorationLine: 'underline',textDecorationStyle: 'double',textDecorationColor: '#ff0000'}}>Doubleunderlinewithcustomcolor</Text><Textstyle={{textDecorationLine: 'underline',textDecorationStyle: 'dashed',textDecorationColor: '#9CDC40'}}>
Dashed underline with custom color
</Text><Textstyle={{textDecorationLine: 'underline',textDecorationStyle: 'dotted',textDecorationColor: 'blue'}}>Dottedunderlinewithcustomcolor</Text><Textstyle={{textDecorationLine: 'none'}}>
None textDecoration
</Text><Textstyle={{textDecorationLine: 'line-through',textDecorationStyle: 'solid'}}>Solidline-through</Text><Textstyle={{textDecorationLine: 'line-through',textDecorationStyle: 'double',textDecorationColor: '#ff0000'}}>
Double line-through with custom color
</Text><Textstyle={{textDecorationLine: 'line-through',textDecorationStyle: 'dashed',textDecorationColor: '#9CDC40'}}>Dashedline-throughwithcustomcolor</Text><Textstyle={{textDecorationLine: 'line-through',textDecorationStyle: 'dotted',textDecorationColor: 'blue'}}>
Dotted line-through with custom color
</Text><Textstyle={{textDecorationLine: 'underline line-through'}}>Bothunderlineandline-through</Text>


2015-04-15 8 48 20

@facebook-github-botfacebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 14, 2015
@KJlmfeKJlmfe mentioned this pull request Apr 14, 2015
@vjeux

Copy link
Copy Markdown
Contributor

Thanks for the pull request! Would be nice to follow the CSS naming convention for this
https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration-style

And, if you can provide a jsfiddle that shows that the code works on a span on the web that would be awesome!

@KJlmfe

Copy link
Copy Markdown
ContributorAuthor

@vjeux I changed the property name to follow the text-decoration-style, such as "solid", "double", "dashed", "dotted".

And, text-decoration-style is only support on firefox. So the jsfiddle web demo is not really needed.

@vjeux

Copy link
Copy Markdown
Contributor

We're trying to use web naming whenever possible, even if it's not implemented everywhere. This way we can redirect users to mdn documentation, and don't have to bikeshed on naming.

@bakso

Copy link
Copy Markdown

That's awesome!
I desire this feature for a long time!

@KJlmfeKJlmfe changed the title <Text> module style add strikeThrough and strikeThroughColorAdd "textDecorationLine, textDecorationStyle, textDecorationColor" style property for <Text> moduleApr 15, 2015
@KJlmfeKJlmfe changed the title Add "textDecorationLine, textDecorationStyle, textDecorationColor" style property for <Text> moduleFix https://github.com/facebook/react-native/issues/753 Add "textDecorationLine, textDecorationStyle, textDecorationColor" style property for <Text> moduleApr 15, 2015
@KJlmfeKJlmfe changed the title Fix https://github.com/facebook/react-native/issues/753 Add "textDecorationLine, textDecorationStyle, textDecorationColor" style property for <Text> moduleFix #753 , Add "textDecorationLine, textDecorationStyle, textDecorationColor" style property for <Text> moduleApr 15, 2015
@KJlmfe

Copy link
Copy Markdown
ContributorAuthor

@vjeux I rewrite the code and change the pull request title and content. Now it follows the CSS naming convention and using method is same with CSS.

And here is working on web demo: https://jsfiddle.net/kjlmfe/a1zvL6s8/1/ (Only for firefox)

@luics

Copy link
Copy Markdown

cool

1 similar comment
@mariodu

Copy link
Copy Markdown

cool

@liangfeidotme

Copy link
Copy Markdown

awesome ! DiaoZhaTian

@SoXeon

Copy link
Copy Markdown

66666!

@imochen

Copy link
Copy Markdown

看到,吊炸天。。。

@brentvatne

Copy link
Copy Markdown
Collaborator

@sahrens - looked at the git blame and wasn't quite sure who to assign here, your name stood out so I just added you, re-assign if I'm off.

@KJlmfe - thanks! can we get a rebase?

@brentvatnebrentvatne changed the title Fix #753 , Add "textDecorationLine, textDecorationStyle, textDecorationColor" style property for <Text> module[Text] Add textDecoration style attributesJun 1, 2015
@sahrens

Copy link
Copy Markdown
Contributor

Looks great! Can you rebase, squash your commits, and re-record the TextExample snapshot test? Set reRecord yes here and run with cmd+U:

https://github.com/facebook/react-native/blob/master/Examples/UIExplorer/UIExplorerTests/UIExplorerTests.m#L97

Also, assigning over to @a2 who is our Text master.

@cssoul

Copy link
Copy Markdown

well done~

@KJlmfe

Copy link
Copy Markdown
ContributorAuthor

@sahrens I had merge branch 'facebook/react-native/master' into my master and resolve the conflicts.

@brentvatne

Copy link
Copy Markdown
Collaborator

@KJlmfe - instead of merging could you do a git rebase -i to squash the commits into one? See this guide

@brentvatne

Copy link
Copy Markdown
Collaborator

@KJlmfe - I'm confused about what's going on here, I will close this but will happily re-open if you rebase and squash into one commit! Thanks 😄

@KJlmfe

Copy link
Copy Markdown
ContributorAuthor

@brentvatne I had rebased and squashed into one commit!

See it KJlmfe@fdaca5d

@pcottle

Copy link
Copy Markdown
Contributor

Can we reopen this? Would be sweet to get underlining in :D

@MossP

MossP commented Jul 3, 2015

Copy link
Copy Markdown

did this ever get merged?

@pcottle

Copy link
Copy Markdown
Contributor

I threw up a fresher version of this over at #1869 that was rebased, hopefully once the Travis CI build is green we can merge!

sahrens pushed a commit to sahrens/react-native that referenced this pull request Jul 7, 2015
Summary:
This is simply a rebased and squashed version of @KJlmfe's PR over at react#845
It was actually already squashed into one commit, but for some reason that was hard to see from the original PR.
Closesreact#1869
Github Author: KJlmfe <kjlmfe@gmail.com>
@pcottle

Copy link
Copy Markdown
Contributor

Woohoo! this made it into the v0.8.0-rc release:
https://github.com/facebook/react-native/releases/tag/v0.8.0-rc

underline all the things

@MossP

Copy link
Copy Markdown

👍

@MossP

Copy link
Copy Markdown

Does it work for you, @pcottle? I don't seem to be seeing any text decoration.

@ide

ide commented Jul 14, 2015

Copy link
Copy Markdown
Contributor

It's working in the UIExplorer.

@MossP

Copy link
Copy Markdown

Ah, it seems that my project has reverted to 0.7.1 somewhere along the line. Apologies. I'll go try again.

@MossP

Copy link
Copy Markdown

That fixed it, thanks @ide. Sorry for the newbie error.

@herbertdai

Copy link
Copy Markdown

Does it support Android in 0.19.0?

@pewh

pewh commented Jun 6, 2017

Copy link
Copy Markdown

Hello, what's the current status of this? I need textDecorationColor props & it didn't work on RN 0.44

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

19 participants

@KJlmfe@vjeux@bakso@luics@mariodu@liangfeidotme@SoXeon@imochen@brentvatne@sahrens@cssoul@constantx@pcottle@MossP@ide@herbertdai@pewh@a2@facebook-github-bot