question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

React Native - Unable to resolve “@aws-amplify/ui/dist/style.css”

See original GitHub issue

** Which Category is your question related to? ** react-native & @aws-amplify/ui

** What AWS Services are you utilizing? ** Amplify & Cognito

** Provide additional details e.g. code snippets **

I’m attempting to customize the AWS Amplify UI signin/signup process by following this article. Every time I import anything from aws-amplify-react I receive this error:

Unable to resolve "@aws-amplify/ui/dist/style.css" from "node_modules/aws-amplify-react/dist/Amplify-UI/Amplify-UI-Components-React.js"

I’ve tried installing @aws-amplify/ui specifically, along with other combinations of aws-amplify versions. Here’s the relevant part of my package.json:

...
"aws-amplify": "^1.1.25",
"aws-amplify-react": "^2.3.5",
"aws-amplify-react-native": "^2.1.9",
...

And the versions of the specific UI & auth that I’ve tried:

"@aws-amplify/auth": "^1.2.21",
"@aws-amplify/ui": "^1.0.2",

Here is the import statement:

import { ConfirmSignIn, ConfirmSignUp, ForgotPassword, RequireNewPassword, SignIn, SignUp, VerifyContact, withAuthenticator } from 'aws-amplify-react';

Any help on resolving this issue is greatly appreciated.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
alebiavaticommented, Apr 10, 2019

Hi @dperconti, thanks for using AWS Amplify!

It looks like you are using both aws-amplify-react and aws-amplify-react-native. The aws-amplify-react module is not meant to be used with React Native. This is because CSS cannot be parsed in RN.

Please follow this guide to pass a theme object to the authenticator component to customize styling.

1reaction
kay-iscommented, Sep 3, 2019

To use this with Expo, which allows Web and Android/iOS builds, I installed aws-amplify-react and aws-amplify-react-native and created two files:

//aws-amplify-react.js
export * from "aws-amplify-react-native";
//aws-amplify-react.web.js
export * from "aws-amplify-react";

With this setup I just have to do import ... from "./aws-amplify-react" and get the right implementation.

Now, I just have to hope they have the same interfaces, haha.

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Unable to resolve "@aws-amplify/ui/dist/style.css"
Unable to resolve "@aws-amplify/ui/dist/style.css" from "node_modules/aws-amplify-react/dist/Amplify-UI/Amplify-UI-Components-React.js".
Read more >
AWS-Amplify/Lobby - Gitter
Unable to resolve module @aws-amplify/ui/dist/style.css from ... /node_modules/aws-amplify-react/dist/Amplify-UI/Amplify-UI-Components-React.js : Module ...
Read more >
用户对问题“AWS Amplify & React Native -无法解析"@aws-amplify/ui ...
Unable to resolve "@aws-amplify/ui/dist/style.css" from "node_modules/aws-amplify-react/dist/Amplify-UI/Amplify-UI-Components-React.js"
Read more >
aws-amplify: 用于使用云服务进行应用程序开发的声明性 ... - Gitee
If you can't migrate to aws-sdk-js-v3 or rely on aws-sdk@2.x, you will need to import it separately. ... import `@aws-amplify/ui/dist/style.css`; ...
Read more >
Software development of explosion! -夢の破片(カケラ ...
React.js でサーバーサイドレンダリングするためのフレームワークです。 ... node_modules/@aws-amplify/ui/dist/style.css Global CSS cannot be ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found