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.

Unable to apply custom theme to withAuthenticator [React Native] [Help wanted]

See original GitHub issue

I am passing the theme object to the withAuthenticator HOC but it doesn’t seem to have any effect. I still seem to have a navbar on top of my every screen, the auth screens as well as my app home screen.

Can anyone confirm having faced this issue? Would this happen due to amplify or is this a side-effect of using react-native-navigation? Any help is appreciated!

Here is how it looks:

54430789-a1402b80-474a-11e9-8986-f7753af03ae8

Here is my code:

/**
 * Dashboard screen with Authenticator wrapper around the entire app.
 */

import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { ConfirmSignUp, AmplifyTheme, ForgotPassword, RequireNewPassword, withAuthenticator } from 'aws-amplify-react-native'
import MySignIn from './MySignIn';
import MySignUp from './MySignUp';
import { THEME_COLOR } from './config';

class Dashboard extends Component {
	render() {
		return (
			<View style={styles.container}>
				<Text>
					<Text style={styles.welcome}>This is Dashboard screen.</Text>
				</Text>
			</View>
		);
	}
}

const myNavBar = Object.assign({}, AmplifyTheme.navBar, { width: 0, height: 0});
const MyTheme = Object.assign({}, AmplifyTheme, { navBar: myNavBar });


const styles = StyleSheet.create({
	welcome: {
		fontSize: 30,
		color: 'black'
	},
	container: {
		flex: 1,
		justifyContent: 'center',
		alignItems: 'center'
	}
});

export default withAuthenticator(Dashboard, false, [
	<MySignIn/>,
	<MySignUp />,
	<ConfirmSignUp/>,
	// <ForgotPassword/> ,
	// <RequireNewPassword/>
], null, MyTheme); 

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:27 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
imehra07commented, Jul 11, 2020

After spending much time and using both Authenticator component and withAuthenticator HOC I have finally found something that worked, hopefully this will help others , source code below.My requirement was only to change the button and link texts and also to have a custom signup config

const AmplifyCustomTheme = Object.assign({}, AmplifyTheme, { button: { …AmplifyTheme.button, backgroundColor: “#156760”, }, buttonDisabled: { …AmplifyTheme.buttonDisabled, backgroundColor: “#6dbdb5”, }, sectionFooterLink: { …AmplifyTheme.sectionFooterLink, color: “#156760”, }, });

export default withAuthenticator( App, false, undefined, null, AmplifyCustomTheme, signupConfig );

0reactions
github-actions[bot]commented, Jul 11, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customise AWS Amplify UI? - Stack Overflow
I'm using React-Native and AWS Amplify for authentication. What I would like to do is change the colours and sizes of the elements....
Read more >
Customizing the authentication experience of Amplify's ...
I want the user to enter their name so that the app can greet them when they login. I also don't need to...
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 >
Authentication - Getting started - JavaScript - AWS Amplify Docs
If you want to re-use an existing authentication resource from AWS (e.g. ... Amplify has pre-built UI components for React, Vue, Angular and...
Read more >
A Complete Guide to the Amplify React Authentication ...
Enable Authentication · App setup · The withAuthenticator component · Add sign out and display user info · Customize your flows with the...
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