Skip to content

Commit

Permalink
navigation.goBack(null) and fix SearchBar cancelButtonText (#1)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tomsotte committed Nov 11, 2019
1 parent a134c55 commit 2f39eab
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import {
StyleSheet,
View,
} from 'react-native';
import { withNavigation, HeaderBackButton } from 'react-navigation';
import { withNavigation } from 'react-navigation';
import { HeaderBackButton } from 'react-navigation-stack';
import { getInset, getStatusBarHeight } from 'react-native-safe-area-view';
import { isIphoneX } from 'react-native-iphone-x-helper';

Expand Down
2 changes: 1 addition & 1 deletion src/SearchBar.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default class SearchBar extends React.PureComponent {
if (this.props.onCancelPress) {
this.props.onCancelPress(this.props.navigation.goBack);
} else {
this.props.navigation.goBack();
this.props.navigation.goBack(null);
}
};
}
Expand Down
1 change: 1 addition & 0 deletions src/SearchLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default class SearchLayout extends React.Component {
tintColor={
this.props.searchInputTintColor || this.props.headerTintColor
}
cancelButtonText={this.props.cancelButtonText}
/>
</Header>

Expand Down

0 comments on commit 2f39eab

Please sign in to comment.