Skip to content

Commit

Permalink
Add support to ellipsizeMode (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorlima authored and Kureev committed Oct 30, 2017
1 parent 304d8eb commit 6102e5f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
**/xcuserdata
.DS_Store
**/.DS_Store
**/*.swp
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ That's it, you're ready to go!
- **title** - (String) - Button's title
- **style** - (Object, Array, Number) - Style object or array of style objects
- **tintColor** - (String) - Title's text color
- **ellipsizeMode** - ('head', 'middle', 'tail', 'clip') - How to [display](https://facebook.github.io/react-native/docs/text.html#ellipsizemode) the text
- **numberOfLines** - (Number) - How to [truncate](https://facebook.github.io/react-native/docs/text.html#numberoflines) the text

### Usage with Webpack
This module uses JSX syntax and requires a compiler such as [babel](https://babeljs.io/).
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const ButtonShape = {
const TitleShape = {
title: PropTypes.string.isRequired,
tintColor: PropTypes.string,
ellipsizeMode: PropTypes.string,
numberOfLines: PropTypes.number
};

const StatusBarShape = {
Expand Down Expand Up @@ -57,7 +59,7 @@ function getTitleElement(data) {

return (
<View style={styles.navBarTitleContainer}>
<Text style={[styles.navBarTitleText, data.style, colorStyle]}>
<Text ellipsizeMode={data.ellipsizeMode} numberOfLines={data.numberOfLines} style={[styles.navBarTitleText, data.style, colorStyle]}>
{data.title}
</Text>
</View>
Expand Down

0 comments on commit 6102e5f

Please sign in to comment.