amazon-archives / aws-sdk-react-native

AWS SDK for React Native (developer preview)
Apache License 2.0
631 stars 68 forks source link

Syntax error in AWSCognitoCredentials #20

Open yorickr opened 7 years ago

yorickr commented 7 years ago

I'm getting a syntax error on this line.

If I understand correctly, it's destructuring callbackId from event, then passing that on to the arrow function. However, is this the correct syntax? I've just updated to the latest React Native version, and it still gives me the error.

Would this fix it?

jschimmoeller commented 7 years ago

+1

SyntaxError /Users/jschimmoeller/projects/eaddr/node_modules/aws-sdk-react-native-core/src/AWSCognitoCredentials.js: Unexpected token, expected , (48:57)

RCTFatal + 104 -[RCTBatchedBridge stopLoadingWithError:] + 1138 25-[RCTBatchedBridge start]_block_invoke_2 + 65 _dispatch_call_block_and_release + 12 _dispatch_client_callout + 8 _dispatch_main_queue_callback_4CF + 1054 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9 __CFRunLoopRun + 2205 CFRunLoopRunSpecific + 420 GSEventRunModal + 161 UIApplicationMain + 159 main + 111 start + 1

jschimmoeller commented 7 years ago

I changed the brackets {} to () and got by it:

  listener.addListener("LoginsRequestedEvent", async (callbackId) => {
    const logins = [await Promise.resolve(this.getLogins())];
    cognitoClient.sendCallbackResponse(callbackId, logins);
  });
yorickr commented 7 years ago

@jschimmoeller that doesn't destructure callbackId from the event though, so even though it's syntactically correct, it'll probably give you errors if it ever gets called.

eddanger commented 7 years ago

@yorickr Your code fixed this for me: https://github.com/yorickr/aws-sdk-react-native/commit/f9e7a26daaff8ca54db729068b9d71eae7314155

willks commented 7 years ago

@jschimmoeller that's how I fixed it. I didn't post a fix when I first encountered it because I thought it was my own babel issue.

Is AWS taking this project seriously? Doubtful, but hopeful.

kanerogers commented 7 years ago

Sigh