Skip to content

Commit a5666a6

Browse files
author
aksonov
committed
support onRight/rightTitle/rightButtonImage for Actions.refresh
1 parent 904c8db commit a5666a6

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

Example/Example.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class Example extends Component {
114114
</Scene>
115115
</Scene>
116116
</Scene>
117-
<Scene key="login" rightTitle="Right" onRight={()=>{}} >
117+
<Scene key="login" >
118118
<Scene key="loginModal" component={Login} title="Login" leftTitle="Cancel" onLeft={Actions.pop}/>
119119
<Scene
120120
key="loginModal2"

Example/components/Login.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ const styles = StyleSheet.create({
2323
});
2424

2525
export default class extends React.Component {
26+
componentDidMount() {
27+
Actions.refresh({
28+
title: 'Login!',
29+
rightTitle: 'rightTitle',
30+
onRight: () => {},
31+
});
32+
}
2633
render() {
2734
const title = this.props.title || 'No Title';
2835
const data = this.props.data || 'No Data';

src/Router.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,12 +103,15 @@ function createNavigationOptions(params) {
103103
res.tabBarIcon = tabBarIcon || icon;
104104
}
105105

106-
if ((rightButtonImage || rightTitle || params.renderRightButton) && onRight) {
106+
if (rightButtonImage || rightTitle || params.renderRightButton || onRight || navigationParams.onRight
107+
|| navigationParams.rightTitle || navigationParams.rightButtonImage) {
107108
res.headerRight = getValue(navigationParams.right || right || rightButton || params.renderRightButton,
108109
{ ...navigationParams, ...screenProps }) || renderRightButton({ ...params, ...navigationParams });
109110
}
110111

111-
if (leftButtonImage || backButtonImage || backTitle || leftTitle || params.renderLeftButton || leftButtonTextStyle || backButtonTextStyle || onLeft) {
112+
if (leftButtonImage || backButtonImage || backTitle || leftTitle || params.renderLeftButton || leftButtonTextStyle
113+
|| backButtonTextStyle || onLeft || navigationParams.leftTitle || navigationParams.onLeft || navigationParams.leftButtonImage
114+
|| navigationParams.backButtonImage || navigationParams.backTitle) {
112115
res.headerLeft = getValue(navigationParams.left || left || leftButton || params.renderLeftButton, { ...params, ...navigationParams, ...screenProps })
113116
|| renderLeftButton({ ...params, ...navigationParams }) || (init ? null : renderBackButton({ ...params, ...navigationParams, ...screenProps }));
114117
}

0 commit comments

Comments
 (0)