Skip to content

Commit 6102e5f

Browse files
igorlimaKureev
authored andcommitted
Add support to ellipsizeMode (#240)
1 parent 304d8eb commit 6102e5f

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ node_modules
22
**/xcuserdata
33
.DS_Store
44
**/.DS_Store
5+
**/*.swp

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ That's it, you're ready to go!
8383
- **title** - (String) - Button's title
8484
- **style** - (Object, Array, Number) - Style object or array of style objects
8585
- **tintColor** - (String) - Title's text color
86+
- **ellipsizeMode** - ('head', 'middle', 'tail', 'clip') - How to [display](https://facebook.github.io/react-native/docs/text.html#ellipsizemode) the text
87+
- **numberOfLines** - (Number) - How to [truncate](https://facebook.github.io/react-native/docs/text.html#numberoflines) the text
8688

8789
### Usage with Webpack
8890
This module uses JSX syntax and requires a compiler such as [babel](https://babeljs.io/).

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const ButtonShape = {
2121
const TitleShape = {
2222
title: PropTypes.string.isRequired,
2323
tintColor: PropTypes.string,
24+
ellipsizeMode: PropTypes.string,
25+
numberOfLines: PropTypes.number
2426
};
2527

2628
const StatusBarShape = {
@@ -57,7 +59,7 @@ function getTitleElement(data) {
5759

5860
return (
5961
<View style={styles.navBarTitleContainer}>
60-
<Text style={[styles.navBarTitleText, data.style, colorStyle]}>
62+
<Text ellipsizeMode={data.ellipsizeMode} numberOfLines={data.numberOfLines} style={[styles.navBarTitleText, data.style, colorStyle]}>
6163
{data.title}
6264
</Text>
6365
</View>

0 commit comments

Comments
 (0)