mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-04-23 12:07:35 +08:00
[Minor] Update Stacks examples for better clarity (#1341)
* Update Stacks{In,Over}Tabs example for better clarity
* Remove redundant navigationOptions in stack examples
* Update text in ReduxExample to clarify which route is being used
This commit is contained in:
committed by
Eric Vicenti
parent
625fc5b109
commit
f575d90986
@@ -3,17 +3,17 @@ import { connect } from 'react-redux';
|
||||
import { Button } from 'react-native';
|
||||
import { NavigationActions } from 'react-navigation';
|
||||
|
||||
const AuthButton = ({ logout, login, isLoggedIn }) => (
|
||||
const AuthButton = ({ logout, loginScreen, isLoggedIn }) => (
|
||||
<Button
|
||||
title={isLoggedIn ? 'Log Out' : 'Log In'}
|
||||
onPress={isLoggedIn ? logout : login}
|
||||
title={isLoggedIn ? 'Log Out' : 'Open Login Screen'}
|
||||
onPress={isLoggedIn ? logout : loginScreen}
|
||||
/>
|
||||
);
|
||||
|
||||
AuthButton.propTypes = {
|
||||
isLoggedIn: PropTypes.bool.isRequired,
|
||||
logout: PropTypes.func.isRequired,
|
||||
login: PropTypes.func.isRequired,
|
||||
loginScreen: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
const mapStateToProps = state => ({
|
||||
@@ -22,7 +22,7 @@ const mapStateToProps = state => ({
|
||||
|
||||
const mapDispatchToProps = dispatch => ({
|
||||
logout: () => dispatch({ type: 'Logout' }),
|
||||
login: () => dispatch(NavigationActions.navigate({ routeName: 'Login' })),
|
||||
loginScreen: () => dispatch(NavigationActions.navigate({ routeName: 'Login' })),
|
||||
});
|
||||
|
||||
export default connect(mapStateToProps, mapDispatchToProps)(AuthButton);
|
||||
|
||||
Reference in New Issue
Block a user