Skip to content
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

Add support for textDecorationLine property #143

Merged
merged 3 commits into from
Jul 19, 2017

Conversation

davixyz
Copy link
Contributor

@davixyz davixyz commented Jul 7, 2017

Hi, this adds support for the textDecorationLine property for text.
Tested on Sketch 44.1
Example of usage:

<Text  style={{textDecorationLine: 'underline'}}>
  Hello World
</Text>

which outputs this:
screen shot 2017-07-07 at 11 13 54 am

The API supports the following attributes: none, underline, line-through, double.

I have some questions though:

  • Should I create some tests around this?
  • How about the documentation, does this grant an update?
  • There was an autoformat on commit, I didn't make some of those changes. is that okay?

@davixyz davixyz mentioned this pull request Jul 7, 2017
@davixyz davixyz force-pushed the textDecoration-feature branch from bd756a6 to 8bc9803 Compare July 7, 2017 18:27
@jemgold
Copy link
Contributor

jemgold commented Jul 7, 2017

Wooo, great work @davidseik :)

  • we haven't found a good solution for tests right now, unfortunately. we're hoping that relying on small functions & flow keeps this mostly error free, but we just test in examples/ 😱
  • Yes! we can add the textDecoration* props to the Styling documentation :)
  • That's fine! Prettier is set up to automatically format files; presumably that file just hadn't been touched since we added it :)

Will dig in this afternon

Copy link
Contributor

@jemgold jemgold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, other than the one property name I flagged.

(btw I'm on vacation next week - feel free to ping other maintainers to get this merged if I miss it)

@@ -12,13 +12,14 @@ const INHERITABLE_STYLES = [
'fontSize',
'fontStyle',
'fontWeight',
'textAlign',
'textDecoration',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we mirror the React Native APIs as much as possible — can you change this to textDecorationLine to match?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Jon, I actually wanted to use the exact same API of textDecorationLine but I found this:
https://github.com/airbnb/react-sketchapp/blob/master/src/stylesheet/expandStyle.js#L61

When the style gets passed down as a textStyle this part expands it to be renamed textDecoration; I don't know why this is needed. I can go ahead and remove the shortHand here and add the textDecorationLine over here so it's propagated like it. Thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙃 I think maybe it was actually correct the first time - looks like I have your original commit and it's indeed working properly by expanding the textDecorationLine into textDecoration. Not sure what went wrong the first time I reviewed it, sorry!

Documentation update looks good - we want the public interface to be textDecorationLine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, then let me change it back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny thing is that because of the expansion they both work textDecoration & textDecorationLine; Thoughts?

@davixyz davixyz force-pushed the textDecoration-feature branch 3 times, most recently from 34e888b to 2775364 Compare July 7, 2017 22:35
@davixyz davixyz force-pushed the textDecoration-feature branch from 2775364 to 7a215c3 Compare July 8, 2017 03:52
@davixyz
Copy link
Contributor Author

davixyz commented Jul 10, 2017

@lelandrichardson @BenjaminCorey can you guys check if this can be merged?

@jemgold jemgold merged commit 207a533 into airbnb:master Jul 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants