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

Focus loss on username/password in expo web #4483

Closed
hew opened this issue Nov 28, 2019 · 11 comments
Closed

Focus loss on username/password in expo web #4483

hew opened this issue Nov 28, 2019 · 11 comments
Assignees
Labels
Auth Related to Auth components/category bug Something isn't working React Native React Native related issue

Comments

@hew
Copy link

hew commented Nov 28, 2019

Describe the bug
Focus loss on username/password fields using expo web.

To Reproduce
Steps to reproduce the behavior:

  1. initialize fresh expo project
  2. npm i aws-amplify-react-native
  3. Try to use the SignIn component:
<Authenticator
  amplifyConfig={myAWSExports}
>
  <SignIn>
</Authenticator>
  1. expo start --web

At this point, you should be able to attempt some input in the browser. Immediately, the fields will lose focus, preventing you from entering any text.

Expected behavior
The expected behaviour is that the input fields should NOT lose focus.

@hew hew added the to-be-reproduced Used in order for Amplify to reproduce said issue label Nov 28, 2019
@hew
Copy link
Author

hew commented Nov 28, 2019

Note: this only happens with the <SignIn /> component. Not any of the others.

@davidbiller
Copy link

For web, use the aws-amplify-react component.
you can add a postfix to the js files like:
login.js
login.web.js

@ericclemmons
Copy link
Contributor

This sounds similar to #3827. @hew Did @davidbiller's suggestion work, with using aws-amplify-react via login.web.js? 🤞

In the meantime, I'll need to setup a project and reproduce it...

@ericclemmons
Copy link
Contributor

I was able to reproduce it here:

https://github.com/ericclemmons/amplify-js-issues-4483

Using a vanilla <TextInput /> works fine, so there's something going on here that's causing the focus to be lost.

Going to mark this as a bug & get some 👀 on this...

@ericclemmons ericclemmons added Auth Related to Auth components/category bug Something isn't working help wanted React Native React Native related issue and removed to-be-reproduced Used in order for Amplify to reproduce said issue labels Dec 6, 2019
@ericclemmons
Copy link
Contributor

ericclemmons commented Dec 17, 2019

Reproduced with the react-native CLI as well:

react-native focus

@ericclemmons
Copy link
Contributor

Aha! So the problem is with using <Authenticator> instead of withAuthenticator(App).

There isn't React Native support for <Authenticator> (or its sub-components), only the Higher-order Component (HoC):

https://aws-amplify.github.io/docs/js/react#add-auth

(Or, based on your usage, Authenticator and SignIn are broken)

@hew Try converting your code to use withAuthenticator(App) and let us know if that resolves it for you.

I'm looping in a few others on the team for extra 👀 on this.

@hew
Copy link
Author

hew commented Dec 31, 2019

@ericclemmons Thanks for the response! 😀

I ended up going with a custom approach using the .signIn method directly. So I don't have any immediate need, here. Thanks again.

@ericclemmons
Copy link
Contributor

@hew Glad to hear you're unblocked 😅 Going to keep this open so that we can at least get this addressed in the future with #3279.

@GeorgeBellTMH
Copy link

GeorgeBellTMH commented Mar 10, 2020

So switching the View to a ScrollView in SignIn.js resolves the issue...

<Header theme={theme}>{I18n.get('Sign in to your account')}</Header> <View style={theme.sectionBody}>

<Header theme={theme}>{I18n.get('Sign in to your account')}</Header> <ScrollView style={theme.sectionBody}>

@amhinson
Copy link
Contributor

amhinson commented Apr 7, 2020

Just merged a fix for this, and it should be in the next release. I'm going to go ahead and close this issue for now, but feel free to open a new issue if the issue persists 👍

@amhinson amhinson closed this as completed Apr 7, 2020
@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 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Auth Related to Auth components/category bug Something isn't working React Native React Native related issue
Projects
None yet
Development

No branches or pull requests

5 participants