Skip to content

Commit 2f39eab

Browse files
authored
navigation.goBack(null) and fix SearchBar cancelButtonText (#1)
* navigation.goBack(null) Add null parameter, If null parameter is not present it won't go back when the Search Screen is a part of a top-level Navigator. * Fix SearchBar cancelButtonText * Fix HeaderBackButton import HeaderBackButton has been moved to react-navigation-stack
1 parent a134c55 commit 2f39eab

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

src/Header.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import {
77
StyleSheet,
88
View,
99
} from 'react-native';
10-
import { withNavigation, HeaderBackButton } from 'react-navigation';
10+
import { withNavigation } from 'react-navigation';
11+
import { HeaderBackButton } from 'react-navigation-stack';
1112
import { getInset, getStatusBarHeight } from 'react-native-safe-area-view';
1213
import { isIphoneX } from 'react-native-iphone-x-helper';
1314

src/SearchBar.ios.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export default class SearchBar extends React.PureComponent {
178178
if (this.props.onCancelPress) {
179179
this.props.onCancelPress(this.props.navigation.goBack);
180180
} else {
181-
this.props.navigation.goBack();
181+
this.props.navigation.goBack(null);
182182
}
183183
};
184184
}

src/SearchLayout.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default class SearchLayout extends React.Component {
5050
tintColor={
5151
this.props.searchInputTintColor || this.props.headerTintColor
5252
}
53+
cancelButtonText={this.props.cancelButtonText}
5354
/>
5455
</Header>
5556

0 commit comments

Comments
 (0)