1.0.0 • Published 4 years ago

aws-cognito-react-native-ui v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

AWS Cognito React Native UI

AWS Cognito React Native UI is a react-native (app) package that allows designers to customize the UX to work with AWS Cognito. Build upon aws-cognito-core-ui.

Install

npm install aws-cognito-react-native-ui # or yarn add aws-cognito-react-native-ui

Usage

Import Package
import AuthProvider from 'aws-cognito-react-native-ui';
Wrap your App with AuthProvider

Pass in your awsconfig, and wrap with AuthProvider.

const awsconfig = {
    Auth: {
        region: 'us-east-1',
        userPoolId: 'us-east-1_ABC',
        userPoolWebClientId: 'ABCDEFGHIJKL'
    }
}

<AuthProvider awsconfig={awsconfig}>
    <MyApp />
</AuthProvider>

That's it! Works out the box!


Customize the UX

Look at the the source code or look at aws-cognito-core-ui Basic Usage.

Design Component Object for each screen

The object keys end in C, (leave alone), the value on the right should point to your UX screen. In this case we are creating the LoadingUI.

Example for React Native (app):

const LoadingUI = () => (
    <View>
        <Text>Loading</Text>
    </View>
);
Link Component to your UX

Reference the aws-cognito-core-ui docs on what is needed to contruct each component.

const MyScreenComponents = {
    signInC: SignInUI,
    errorMsgC: ErrorMsgUI,
    forgotPasswordC: ForgotPasswordUI,
    forgotPasswordSubmitC: ForgotPasswordSubmitUI,
    signOutC: SignOutUI,
    signUpC: SignUpUI,
    confirmSignUpC: ConfirmSignUpUI,
    confirmSignInC: ConfirmSignInUI,
    newPasswordRequiredC: NewPasswordRequiredUI,
    mfaSetupC: MfaSetupUI,
    changePasswordC: ChangePasswordUI,
    changePasswordSuccessC: ChangePasswordSuccessUI,
    loadingC: LoadingUI,
};

Feeling lazy and want to just customize the signInC components.

import { defaultComponentObject } from 'aws-cognito-react-ui';
const MyScreenComponents = {
    ...defaultComponentObject,
    signInC: YourSignInUI,
};
Wrap your App with AuthProvider

Pass in your awsconfig, along with your screens to ComponentObject.

<AuthProvider awsconfig={awsconfig} ComponentObject={MyScreenComponents}>
    <MyApp />
</AuthProvider>

Create your own Package with your own Design.

FAQs

Support

Feedback / Questions / Thoughts / Hire me?

Discord