From e898e7b32cf539b3a1e6e8df5a42e16cf201747d Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Mon, 10 Oct 2016 14:11:08 +0900 Subject: [PATCH 1/4] Fix the style of the NavBar content wrapper --- src/NavBar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NavBar.js b/src/NavBar.js index 0cf067182..700ddad4a 100644 --- a/src/NavBar.js +++ b/src/NavBar.js @@ -483,7 +483,7 @@ class NavBar extends React.Component { const navigationBarBackgroundImage = this.props.navigationBarBackgroundImage || state.navigationBarBackgroundImage; const contents = ( - + {renderTitle ? renderTitle(navProps) : state.children.map(this.renderTitle, this)} {renderBackButton(navProps) || renderLeftButton(navProps)} {renderRightButton(navProps)} From 252cd41d206d01636543d7d3e017e59f237b14be Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Mon, 10 Oct 2016 17:18:43 +0900 Subject: [PATCH 2/4] Wrap customized buttons by customized styles --- src/NavBar.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/NavBar.js b/src/NavBar.js index 700ddad4a..0d44bb768 100644 --- a/src/NavBar.js +++ b/src/NavBar.js @@ -465,8 +465,20 @@ class NavBar extends React.Component { return props => {component(props)}; }; - const leftButtonStyle = [styles.leftButton, { alignItems: 'flex-start' }]; - const rightButtonStyle = [styles.rightButton, { alignItems: 'flex-end' }]; + const leftButtonStyle = [ + styles.leftButton, + { alignItems: 'flex-start' }, + this.props.leftButtonStyle, + state.leftButtonStyle, + selected.leftButtonStyle, + ]; + const rightButtonStyle = [ + styles.rightButton, + { alignItems: 'flex-end' }, + this.props.rightButtonStyle, + state.rightButtonStyle, + selected.rightButtonStyle, + ]; const renderLeftButton = wrapByStyle(selected.renderLeftButton, leftButtonStyle) || wrapByStyle(selected.component.renderLeftButton, leftButtonStyle) || From 09e73b58dc7209599c2ae8dbe6ea962ab9cfcd6f Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Mon, 10 Oct 2016 17:19:09 +0900 Subject: [PATCH 3/4] Permit `render*Button` to the root scene --- src/NavBar.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/NavBar.js b/src/NavBar.js index 0d44bb768..d5c047156 100644 --- a/src/NavBar.js +++ b/src/NavBar.js @@ -482,12 +482,15 @@ class NavBar extends React.Component { const renderLeftButton = wrapByStyle(selected.renderLeftButton, leftButtonStyle) || wrapByStyle(selected.component.renderLeftButton, leftButtonStyle) || + wrapByStyle(state.renderLeftButton, leftButtonStyle) || this.renderLeftButton; const renderRightButton = wrapByStyle(selected.renderRightButton, rightButtonStyle) || wrapByStyle(selected.component.renderRightButton, rightButtonStyle) || + wrapByStyle(state.renderRightButton, rightButtonStyle) || this.renderRightButton; const renderBackButton = wrapByStyle(selected.renderBackButton, leftButtonStyle) || wrapByStyle(selected.component.renderBackButton, leftButtonStyle) || + wrapByStyle(state.renderBackButton, leftButtonStyle) || this.renderBackButton; const renderTitle = selected.renderTitle || selected.component.renderTitle || From 5eb7fd5b02084eeb6f6fe8c181ed57e0c674f923 Mon Sep 17 00:00:00 2001 From: "James G. Kim" Date: Mon, 10 Oct 2016 17:30:11 +0900 Subject: [PATCH 4/4] Add the missing prop type definition for `rightButtonStyle` --- src/NavBar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/NavBar.js b/src/NavBar.js index d5c047156..24b9bb676 100644 --- a/src/NavBar.js +++ b/src/NavBar.js @@ -154,6 +154,7 @@ const propTypes = { wrapBy: PropTypes.any, component: PropTypes.any, backButtonTextStyle: Text.propTypes.style, + rightButtonStyle: View.propTypes.style, leftButtonStyle: View.propTypes.style, leftButtonIconStyle: Image.propTypes.style, getTitle: PropTypes.func,