Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React customize-withauthenticator doesnt work on v2.0.0-2.0.1 #1603

Closed
DmitryNefedov opened this issue Sep 10, 2018 · 14 comments
Closed

React customize-withauthenticator doesnt work on v2.0.0-2.0.1 #1603

DmitryNefedov opened this issue Sep 10, 2018 · 14 comments
Labels
investigating This issue is being investigated React React related issues

Comments

@DmitryNefedov
Copy link

Describe the bug
Using withAuthenticatior with passed elements as described in the guide works on v 1.0.8 but shows an empty page on v 2.0.0 or 2.0.1

To Reproduce
Steps to reproduce the behavior:

  1. use code based on Docs
import React from 'react';
import { withAuthenticator, SignIn, SignUp, ForgotPassword, RequireNewPassword } from 'aws-amplify-react';

class CustomNoSignUp extends SignUp {

  render() {
    if (this.props.authState !== 'signUp') { return null; }
    return (<div>Please check with your administrator to create a user</div>);
  }
}

class App extends React.Component {
  render() {

    if (this.props.authState !== 'signedIn') { return null; }

    return (
     <div style={{textAlign: 'center'}}>
        <h1>Hello World</h1>
      </div>);
  }
}

export default withAuthenticator(App,
  { includeGreetings: true },
  [
    <SignIn />,
    <CustomNoSignUp/>,
    <ForgotPassword/>,
    <RequireNewPassword/>
  ]
);

Expected behavior
Login form should be shown, after login "Hello World" should be shown

Actual behavior
Blank screen, no errors in console/dev-server

@haverchuck haverchuck added the React React related issues label Sep 10, 2018
@mkrn
Copy link

mkrn commented Sep 10, 2018

Second that, can't seem to find the issue by looking through the code.. There are no errors either.. Except from some 400 errors on requests to cognito backend

@pronevich
Copy link

Same issue

@ghost
Copy link

ghost commented Sep 16, 2018

Same issue.

@ghost
Copy link

ghost commented Oct 24, 2018

same issue . Can someone look in to this issue?

@emmkong
Copy link

emmkong commented Oct 25, 2018

@DmitryNefedov due to your custom SignUp component is extending the base SignUp component,
You should override this showComponent(theme) function instead of the render method.

https://github.com/aws-amplify/amplify-js/blob/master/packages/aws-amplify-react/src/Auth/SignUp.jsx
showComponent(theme) { const { hide } = this.props; if (hide && hide.includes(SignUp)) { return null; } ...

else the code above will hide your custom component too.

Hope this helped.

@DmitryNefedov
Copy link
Author

@emmkong,
its not just hiding sign up.
It hides the wrapped element.
If it has been changed to use with showComponent, shouldnt the docs been updated?

@emmkong
Copy link

emmkong commented Oct 29, 2018

@DmitryNefedov I agree that the behavior of custom Auth UI components has been changed since version 2.0 and it hasn't mentioned in any document yet. :(

Do you mind to elaborate more about what wrapped element that you are expecting so that I could help you a bit more. Thanks.

@richardm-surevine
Copy link

The same thing happens if you use the base SignUp component without even customising it, if you pass it in like this.

Seems a bit broken.

@adamdiy
Copy link

adamdiy commented Feb 3, 2019

having the same problem with v1.1.19, after following the docs at https://aws-amplify.github.io/docs/js/authentication

@robhyb19
Copy link

Bump.
Seeing the same issue after following the docs ( https://aws-amplify.github.io/docs/js/authentication ) and after following recommendations made in this issue.

@elorzafe elorzafe added investigating This issue is being investigated and removed investigating This issue is being investigated labels Mar 1, 2019
@jordanranz jordanranz added this to the UI Components Refactor milestone May 7, 2019
@jordanranz
Copy link
Contributor

FYI, we have started an RFC discussion for a proposed Amplify UI Component refactor to increase customizability and flexibility for our components. Please feel free to add any additional comments to the following issue:

#3279

@stale
Copy link

stale bot commented Jun 21, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale
Copy link

stale bot commented Jun 28, 2019

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

@stale stale bot closed this as completed Jun 28, 2019
@github-actions
Copy link

This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.

Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels or Discussions for those types of questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
investigating This issue is being investigated React React related issues
Projects
None yet
Development

No branches or pull requests

10 participants