React Native - withAuthenticator - Custom Greetings UI
See original GitHub issue** Which Category is your question related to? **
- Authentication
** What AWS Services are you utilizing? **
- Cognito, AppSync
Hi There! Is it possible to replace the built in Greetings
component in aws-amplify-react-native
with a custom component when using withAuthenticator
?
From looking at the related code for withAuthenticator
here it appears that the Amplify’s built-in Greetings
component is hard-coded.
We’ve followed the documentation for custom UI here and have successfully built our own components for SignIn
, etc. Unfortunately we have been unable override Greetings
.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Authenticator - React Native - AWS Amplify Docs
The withAuthenticator HOC wraps an Authenticator component. Using Authenticator directly gives you more customization options for your UI.
Read more >How to customise the UI after a user is signed in using ...
ok finally finally figured this out... use hideDefault={true} in , then add all the other components except for Greetings (includes signout ...
Read more >Amplify UI's new Authenticator component makes it easy to ...
In this blog post we will deploy a React app with Amplify Hosting, set up auth, and then integrate the <Authenticator> UI component...
Read more >AWS Amplify Authentication in React Native (Full tutorial)
Learn how to integrate a custom authentication UI in React Native with AWS Amplify Authentication. The tutorial will walk you through the ...
Read more >A Complete Guide to the Amplify React Authentication ...
A Complete Guide to the Amplify React Authentication Components. A few weeks ago, the team I ... import { withAuthenticator } from '@aws-amplify/ui-react'....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Glad you got this working!
I think your solution is the preferred way to achieve what you are asking for. Since the Greetings component simply provides a UI wrapper for sign out and username text, it is simpler to use the Auth method mentioned above and create your own Header above your app. I will close this for now. Please reopen if you experience any related issue.
Hi @jordanranz! Thanks for reminding me of this issue!
We ended up going down an alternate path to achieve the same results (I’ll explain this later), but I can give a brief overview of the issue we encountered.
Unfortunately I don’t have the exact code we had written handy, but it was similar to this:
Unfortunately this approach didn’t work for us and the custom Greetings component didn’t appear to display in the
Authenticator
component.I wasn’t able to troubleshoot the root issue, but I believe the custom
Greetings
component was not displayed due to the following:Greetings
component defines arender
function as opposed to ashowComponent
function.Greetings
class does not set the_validAuthStates
property in the constructor (example).The approach we ultimately went forward with was creating our own custom component to display the user message by reading from
Auth.currentAuthenticatedUser()
directly. Our custom component was able to initiate a sign out by utilizing theonStateChange
prop that is passed down fromwithAuthenticator
.I would say we were able to work around the issue we were encountering, so feel free to close this issue if necessary.