Guest User

Untitled

a guest
May 20th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3.  
  4. class LoginScreen extends React.Component {
  5. // ...
  6.  
  7. componentWillReceiveProps(newProps) {
  8. if (newProps.authenticated === true) {
  9. this.handleSuccessfulLogin();
  10. }
  11. }
  12.  
  13. handleSuccessfulLogin() {
  14. this.props.navigator.resetTo({
  15. screen: 'MyApp.Dashboard',
  16. backButtonHidden: true,
  17. animated: true,
  18. animationType: 'fade',
  19. });
  20. }
  21.  
  22. render() {
  23. // ..
  24. }
  25. }
  26.  
  27. LoginScreen.propTypes = {
  28. authenticated: PropTypes.bool.isRequired,
  29. navigator: PropTypes.shape({
  30. resetTo: PropTypes.func.isRequired,
  31. }).isRequired,
  32. };
  33.  
  34. export default LoginScreen;
Add Comment
Please, Sign In to add comment