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

Make withAuthenticator HOC configurable #110

Merged

Conversation

rlmartin
Copy link
Contributor

This will allow for building custom SignIn, Loading, etc components but still leveraging the ease of withAuthenticator.

@codecov-io
Copy link

codecov-io commented Dec 29, 2017

Codecov Report

Merging #110 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #110   +/-   ##
=======================================
  Coverage   90.78%   90.78%           
=======================================
  Files          53       53           
  Lines        2517     2517           
  Branches      510      510           
=======================================
  Hits         2285     2285           
  Misses        221      221           
  Partials       11       11
Impacted Files Coverage Δ
packages/aws-amplify-react/src/Auth/index.jsx 85% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fc07d3b...40e88da. Read the comment docs.

@mlabieniec
Copy link
Contributor

@rlmartin the structure has changed a bit here, the core logic has moved into aws-amplify, can you have a look and see if you can merge these into the latest. Thanks.

@rlmartin
Copy link
Contributor Author

rlmartin commented Feb 4, 2018

@mlabieniec sure I'll take a look.

@rlmartin rlmartin force-pushed the configurable-withauthenticator branch from 042f0a3 to ed18cb8 Compare February 5, 2018 04:51
@rlmartin
Copy link
Contributor Author

@mlabieniec in case you missed it, I updated this PR.

@powerful23
Copy link
Contributor

powerful23 commented Feb 13, 2018

@rlmartin could you provide us an example to show how does it work with the code? I am trying to pass a customized component into the array and expecting to just get that component rendered like:

import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';

export default class myComponent extends React.Component {
    render() {
        return (
            <Button title="Record" />
        );
    }
}

and using it in the hoc like:

withAuthenticator(App, false, [myComponent]);

But turns out to be an error saying:
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.

Thanks. Also really appreciate it if you could add it into the readme.

@rlmartin
Copy link
Contributor Author

Hi @powerful23 - I believe that's an error from React Native. You need to pass in an instance of the class, not the class itself (i.e. <myComponent />). This is how the Authenticator class works: https://github.com/aws/aws-amplify/blob/master/packages/aws-amplify-react-native/src/Auth/Authenticator.js#L107

I'll update the README :)

@rlmartin rlmartin force-pushed the configurable-withauthenticator branch from 342c124 to f399d8e Compare February 14, 2018 04:49
@powerful23 powerful23 self-requested a review February 14, 2018 21:30
Copy link
Contributor

@powerful23 powerful23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Great job!

@powerful23 powerful23 merged commit 06a3a8a into aws-amplify:master Feb 14, 2018
@rlmartin rlmartin deleted the configurable-withauthenticator branch February 19, 2018 17:45
@github-actions
Copy link

This pull request 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 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants