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
[Text] textalign should implement 'justify' css property #529
Comments
Couldn't you use the flexbox styling? |
Nope, it seems only supported styling as documented in the api here can be used: Please correct me with a working example if I am wrong. Ability to apply flexbox styling will be big relief! I know it can be applied to reactjs vanilla library. Native ios version seems to be different beast. |
Oh, it is the same one I am trying. The hitch is that "justify" property is not available for textAlign - so, I can't get newspaper like layout. A sample code below: var styleTest = StyleSheet.create({
title: {
fontSize : 20,
color : 'rgb(0,0,255)',
textAlign: "justify"
}
}); Here is an example of how it looks like in css: http://www.w3schools.com/cssref/tryit.asp?filename=trycss_text-align_all |
I did some more research about justified text alignment. It seems that on the web, text alignment isn't done as well as desktop publishing tools like latex because of lack of hypenations. So, something like hypenator.js might be of interest. CSS3 now includes hypens property. |
@vjeux - any particular reason for not including justify? If not, we can tag this as a good first task |
We had justify and then realized Android doesn't support justify so we removed it. Probably worth adding it back and figure out something on android side, pretty crazy that it is not supported |
+1 to shipping it on iOS. Seems ok for Android to fall back to left or center alignment since the app is still usable, sort of like how older browsers just drop rules they don't understand on the web until one day the property is supported. |
Agreed. Pull request welcome |
textAlign: 'justify', brings up the "Error while updating property 'textAlign' of a view managed by: RCTText. on Android. Would be nice if it just did left or center or anything but crashing. |
@jim-lake Can you open a new issue for this? |
👍 |
new issue for this #5408 |
Summary:Fixes #5408 as per ide and vjeux suggestions here #529 (comment) Could've been probably done in a single `if` clause, but this is more explicit and leaves potential place for future implementation (if we ever decide to do so) Closes #7197 Differential Revision: D3217740 Pulled By: vjeux fb-gh-sync-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6 fbshipit-source-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
Summary:Fixes facebook#5408 as per ide and vjeux suggestions here facebook#529 (comment) Could've been probably done in a single `if` clause, but this is more explicit and leaves potential place for future implementation (if we ever decide to do so) Closes facebook#7197 Differential Revision: D3217740 Pulled By: vjeux fb-gh-sync-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6 fbshipit-source-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
Summary: Finished adding support for justified text on iOS... just had to expose a prop value. Fixes #529 Closes facebook/react-native#1486 Github Author: James Ide <ide@jameside.com> Test Plan: View the Text example in the UIExplorer and see that all but the last lines of text in the justified text example are justified and extend to the far right of the available space. Tested on iOS 8, iPhone 6 simulator. ![text](https://cloud.githubusercontent.com/assets/379606/7926252/a90d2e98-0884-11e5-9f12-5cbb27505a0b.png)
Summary:Fixes facebook#5408 as per ide and vjeux suggestions here facebook#529 (comment) Could've been probably done in a single `if` clause, but this is more explicit and leaves potential place for future implementation (if we ever decide to do so) Closes facebook#7197 Differential Revision: D3217740 Pulled By: vjeux fb-gh-sync-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6 fbshipit-source-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
Summary:Fixes facebook#5408 as per ide and vjeux suggestions here facebook#529 (comment) Could've been probably done in a single `if` clause, but this is more explicit and leaves potential place for future implementation (if we ever decide to do so) Closes facebook#7197 Differential Revision: D3217740 Pulled By: vjeux fb-gh-sync-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6 fbshipit-source-id: aa08a5c42e43c1abe17b72a424ee96146f2667f6
Guys, why is not implemented in Android anyway? I just hit that issue, and makes no sense for me |
@ammichael it is because Android itself doesn't support it, which is pretty crazy if you ask me. If we are really motivated we could probably hack around android itself to make it support it but this hasn't been high in the priority list. Hopefully they'll implement it at some point in the future and we can just use it in react native |
@vjeux 'Android itself doesn't support it'. Not sure if I should laugh or curse about it. For curiosity sake.. why not? What's the alternative to get the same 'effect'? |
@ammichael your guess is as good as mine: http://stackoverflow.com/a/1293541 People are using webviews to achieve that but this is insane and likely not performant at all. I'm not sure of any good workaround I'm afraid :( |
Actually, there's now a 3rd party library for it: https://github.com/bluejamesbond/TextJustify-Android would be great to do bindings for it so it can be used inside of React Native :) |
Yeah, I found the same alternative, and I'll use the same word as you did to describe it: insane. That lib seems to do the work, and seems more reasonable than to create a web view, and I would love to know how to create the bindings, but I don't :( |
Feels almost like a joke all that is needed just because 'text align justify'. I'll give it a try later, then |
cc @lacker |
I need 'justify' option too |
It seems that |
"justify" property seems to be crucial in order to implement nice text alignment we know so well from newspapers and magazines (and latex). Right now, it doesn't seem to be implemented. If it is a simple implementation, I could try to take a stab at it, if someone shows me how it is implemented for other values.
The text was updated successfully, but these errors were encountered: