Skip to content

Commit

Permalink
add possibility to define title as static method for the component
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavlo Aksonov committed Jul 15, 2016
1 parent e964c80 commit 822e83f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-router-flux",
"version": "3.31.0",
"version": "3.31.1",
"description": "React Native Router using Flux architecture",
"repository": {
"type": "git",
Expand Down
8 changes: 7 additions & 1 deletion src/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,13 @@ class NavBar extends React.Component {
}

renderTitle(childState, index:number) {
const title = this.props.getTitle ? this.props.getTitle(childState) : childState.title;
let title = this.props.getTitle ? this.props.getTitle(childState) : childState.title;
if (title === undefined && childState.component && childState.component.title) {
title = childState.component.title;
}
if (typeof(title) === 'function') {
title = title(childState);
}
return (
<Animated.Text
key={childState.key}
Expand Down

0 comments on commit 822e83f

Please sign in to comment.