Skip to content
This repository has been archived by the owner on Feb 24, 2018. It is now read-only.

Imported modules are undefined with React Native #638

Open
brianfitzgerald opened this issue Dec 29, 2017 · 2 comments
Open

Imported modules are undefined with React Native #638

brianfitzgerald opened this issue Dec 29, 2017 · 2 comments

Comments

@brianfitzgerald
Copy link

I am working with react-native 0.5. To install, I did an npm install amazon-cognito-identity-js and ran react-native link amazon-cognito-identity-js.

I am importing the modules like this:
import { CognitoUserPool, AuthenticationDetails, CognitoUser } from 'amazon-cognito-identity-js'

However, when I run the app, and I console.log(AuthenticationDetails), it comes back as undefined. I also get the error that AuthenticationDetails is not a function when I try to implement the sample code.

Did I miss a step? I've lost a day on trying to debug this, and it's completely confounded me.

@kpolley
Copy link

kpolley commented Dec 29, 2017

Perhaps your initializing it incorrectly? Below is how I use it;

import {
  AuthenticationDetails,
  CognitoUser,
  CognitoUserPool,
  CognitoUserAttribute
} from 'react-native-aws-cognito-js';

...
const authenticationDetails = new AuthenticationDetails({
        Username: username,
        Password: password
      });

@brianfitzgerald
Copy link
Author

I copy-pasted your import statement directly, and I'm still seeing the same error. The console.log is still returning undefined. It looks like the files are linked correctly in Xcode, as well.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants