Skip to content

Commit

Permalink
[Text] Support "textAlign: justify" in Text components
Browse files Browse the repository at this point in the history
Summary:
Finished adding support for justified text on iOS... just had to expose a prop value.
Fixes #529

Closes #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)
  • Loading branch information
ide committed Jun 15, 2015
1 parent 58c58d9 commit 5d6a89b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions Examples/UIExplorer/TextExample.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@ exports.examples = [
<Text style={{textAlign: 'right'}}>
right right right right right right right right right right right right right
</Text>
<Text style={{textAlign: 'justify'}}>
justify: this text component's contents are laid out with "textAlign: justify"
and as you can see all of the lines except the last one span the
available width of the parent container.
</Text>
</View>
);
},
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (void)setUp
_runner = RCTInitRunnerForApp(@"Examples/UIExplorer/UIExplorerApp.ios");

// If tests have changes, set recordMode = YES below and run the affected
// tests on an iPhone5, iOS 8.1 simulator.
// tests on an iPhone5, iOS 8.3 simulator.
_runner.recordMode = NO;
}

Expand Down
3 changes: 2 additions & 1 deletion Libraries/Text/TextStylePropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ var TextStylePropTypes = Object.assign(Object.create(ViewStylePropTypes), {
lineHeight: ReactPropTypes.number,
color: ReactPropTypes.string,
containerBackgroundColor: ReactPropTypes.string,
// NOTE: "justify" is supported only on iOS
textAlign: ReactPropTypes.oneOf(
['auto' /*default*/, 'left', 'right', 'center']
['auto' /*default*/, 'left', 'right', 'center', 'justify']
),
writingDirection: ReactPropTypes.oneOf(
['auto' /*default*/, 'ltr', 'rtl']
Expand Down

0 comments on commit 5d6a89b

Please sign in to comment.