Skip to content

Commit

Permalink
feat: breaking changes with new props
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathChaos committed Jun 5, 2022
1 parent c8d52d2 commit 771e5c0
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 44 deletions.
45 changes: 23 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import LoginScreen from "react-native-login-screen";
<LoginScreen
logoImageSource={require("./assets/logo-example.png")}
onLoginPress={() => {}}
onHaveAccountPress={() => {}}
onSignupPress={() => {}}
onEmailChange={(email: string) => {}}
onPasswordChange={(password: string) => {}}
/>
Expand All @@ -73,7 +73,7 @@ import LoginScreen, { SocialButton } from "react-native-login-screen";
<LoginScreen
logoImageSource={require("./assets/logo-example.png")}
onLoginPress={() => {}}
onHaveAccountPress={() => {}}
onSignupPress={() => {}}
onEmailChange={(email: string) => {}}
onPasswordChange={(password: string) => {}}
>
Expand All @@ -95,29 +95,30 @@ import LoginScreen, { SocialButton } from "react-native-login-screen";

### Fundamentals

| Property | Type | Default | Description |
| ------------------ | :------: | :-------: | ------------------------------------------------------------------ |
| onLoginPress | function | undefined | set your own function when the `login button` is pressed |
| onHaveAccountPress | function | undefined | set your own function when the `have an account button` is pressed |
| onEmailChange | function | undefined | set your own function when `email` textinput has a change |
| onPasswordChange | function | undefined | set your own function when `password` textinput has a change |
| logoImageSource | source | undefined | set your own logo |
| Property | Type | Default | Description |
| ---------------- | :------: | :-------: | ------------------------------------------------------------- |
| onLoginPress | function | undefined | set your own function when the `login button` is pressed |
| onSignupPress | function | undefined | set your own function when the `Create an account` is pressed |
| onEmailChange | function | undefined | set your own function when `email` textinput has a change |
| onPasswordChange | function | undefined | set your own function when `password` textinput has a change |
| logoImageSource | source | undefined | set your own logo |

### Customizations (Optional)

| Property | Type | Default | Description |
| ----------------------- | :--------: | :------------------------: | --------------------------------------------------- |
| haveAccountText | string | "Already have an account?" | change the have account text |
| disableDivider | boolean | false | disable the divider if you do not want to use it |
| disableSocialButtons | boolean | false | disable the all social buttons |
| style | ViewStyle | default | set/override the default style for the container |
| dividerStyle | ViewStyle | default | set/override the default divider style |
| logoImageStyle | ImageStyle | default | set/override the default image style |
| textInputContainerStyle | ViewStyle | default | set/override the default text input container style |
| loginButtonStyle | ViewStyle | default | set/override the default login button style |
| loginTextStyle | TextStyle | default | set/override the default login text style |
| haveAccountButtonStyle | ViewStyle | default | set/override the default have account button style |
| haveAccountTextStyle | TextStyle | default | set/override the default have account text style |
| Property | Type | Default | Description |
| ----------------------- | :--------: | :-----------------: | --------------------------------------------------- |
| signupText | string | "Create an account" | change the sign up text |
| disableSignup | boolean | false | disable the signup if you do not want to use it |
| disableDivider | boolean | false | disable the divider if you do not want to use it |
| disableSocialButtons | boolean | false | disable the all social buttons |
| style | ViewStyle | default | set/override the default style for the container |
| dividerStyle | ViewStyle | default | set/override the default divider style |
| logoImageStyle | ImageStyle | default | set/override the default image style |
| textInputContainerStyle | ViewStyle | default | set/override the default text input container style |
| loginButtonStyle | ViewStyle | default | set/override the default login button style |
| loginTextStyle | TextStyle | default | set/override the default login text style |
| signupStyle | ViewStyle | default | set/override the default signup button style |
| signupTextStyle | TextStyle | default | set/override the default signup text style |

### Default Social Login Buttons (Optional)

Expand Down
Binary file removed assets/Screenshots/react-native-login-screen-v2.gif
Binary file not shown.
Binary file modified assets/Screenshots/react-native-login-screen.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions example/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useState} from 'react';
import {View, StatusBar} from 'react-native';
import {LoginScreen, SocialButton} from 'react-native-login-screen';
import LoginScreen, {SocialButton} from './build/dist/index';

const App = () => {
const [username, setUsername] = useState(null);
Expand All @@ -13,7 +13,7 @@ const App = () => {
<LoginScreen
logoImageSource={require('./assets/logo-example.png')}
onLoginPress={() => {}}
onHaveAccountPress={() => {}}
onSignupPress={() => {}}
onEmailChange={(email: string) => {}}
onPasswordChange={(password: string) => {}}
/>
Expand Down
Binary file added example/assets/fonts/Now-Black.otf
Binary file not shown.
Binary file added example/assets/fonts/Now-Bold.otf
Binary file not shown.
Binary file added example/assets/fonts/Now-Light.otf
Binary file not shown.
Binary file added example/assets/fonts/Now-Medium.otf
Binary file not shown.
Binary file added example/assets/fonts/Now-Regular.otf
Binary file not shown.
Binary file added example/assets/fonts/Now-Thin.otf
Binary file not shown.
Binary file added example/assets/fonts/NowAlt-Black.otf
Binary file not shown.
Binary file added example/assets/fonts/NowAlt-Bold.otf
Binary file not shown.
Binary file added example/assets/fonts/NowAlt-Light.otf
Binary file not shown.
Binary file added example/assets/fonts/NowAlt-Medium.otf
Binary file not shown.
Binary file added example/assets/fonts/NowAlt-Regular.otf
Binary file not shown.
Binary file added example/assets/fonts/NowAlt-Thin.otf
Binary file not shown.
Binary file added example/assets/logo-example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions lib/LoginScreen.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ interface Style {
passwordTextInputContainer: ViewStyle;
loginButtonStyle: ViewStyle;
loginTextStyle: TextStyle;
haveAccountButtonStyle: ViewStyle;
haveAccountTextStyle: TextStyle;
signupStyle: ViewStyle;
signupTextStyle: TextStyle;
dividerStyle: ViewStyle;
socialLoginContainer: ViewStyle;
facebookSocialButtonTextStyle: TextStyle;
Expand Down Expand Up @@ -65,12 +65,12 @@ export default StyleSheet.create<Style>({
fontSize: 16,
fontWeight: "bold",
},
haveAccountButtonStyle: {
signupStyle: {
marginTop: 32,
alignItems: "center",
justifyContent: "center",
},
haveAccountTextStyle: {
signupTextStyle: {
color: "#acabb0",
},
dividerStyle: {
Expand Down
30 changes: 16 additions & 14 deletions lib/LoginScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,24 @@ type CustomTextStyleProp = StyleProp<TextStyle> | Array<StyleProp<TextStyle>>;

const dummyFunction = () => {};
export interface ILoginScreenProps {
haveAccountText?: string;
signupText?: string;
disableDivider?: boolean;
logoImageSource: any;
disableSocialButtons?: boolean;
emailPlaceholder?: string;
passwordPlaceholer?: string;
disableSignup?: boolean;
style?: CustomStyleProp;
dividerStyle?: CustomStyleProp;
logoImageStyle?: CustomImageStyleProp;
textInputContainerStyle?: CustomStyleProp;
loginButtonStyle?: CustomStyleProp;
loginTextStyle?: CustomTextStyleProp;
haveAccountButtonStyle?: CustomStyleProp;
haveAccountTextStyle?: CustomTextStyleProp;
signupStyle?: CustomStyleProp;
signupTextStyle?: CustomTextStyleProp;
children?: any;
onLoginPress: () => void;
onHaveAccountPress: () => void;
onSignupPress: () => void;
onEmailChange: (email: string) => void;
onPasswordChange: (password: string) => void;
onFacebookPress?: () => void;
Expand All @@ -57,15 +58,15 @@ const LoginScreen: React.FC<ILoginScreenProps> = ({
logoImageStyle,
loginTextStyle,
loginButtonStyle,
haveAccountTextStyle,
haveAccountButtonStyle,
signupTextStyle,
signupStyle,
textInputContainerStyle,
haveAccountText = "Already have an account?",
signupText = "Create an account",
disableDivider,
logoImageSource,
onLoginPress,
disableSocialButtons,
onHaveAccountPress,
onSignupPress,
onEmailChange,
onPasswordChange,
onFacebookPress = dummyFunction,
Expand All @@ -74,6 +75,7 @@ const LoginScreen: React.FC<ILoginScreenProps> = ({
onDiscordPress = dummyFunction,
emailPlaceholder = "Email",
passwordPlaceholer = "Password",
disableSignup = false,
children,
}) => {
const Logo = () => (
Expand Down Expand Up @@ -106,13 +108,13 @@ const LoginScreen: React.FC<ILoginScreenProps> = ({
</TouchableOpacity>
);

const AlreadyHaveAccount = () => (
const SignUp = () => (
<TouchableOpacity
style={[styles.haveAccountButtonStyle, haveAccountButtonStyle]}
onPress={onHaveAccountPress}
style={[styles.signupStyle, signupStyle]}
onPress={onSignupPress}
>
<Text style={[styles.haveAccountTextStyle, haveAccountTextStyle]}>
{haveAccountText}
<Text style={[styles.signupTextStyle, signupTextStyle]}>
{signupText}
</Text>
</TouchableOpacity>
);
Expand Down Expand Up @@ -156,7 +158,7 @@ const LoginScreen: React.FC<ILoginScreenProps> = ({
<Logo />
<TextInputContainer />
<LoginButton />
<AlreadyHaveAccount />
{!disableSignup && <SignUp />}
{!disableDivider && <Divider />}
<View style={styles.socialLoginContainer}>
{children || <DefaultSocialLoginButtons />}
Expand Down
3 changes: 2 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import LoginScreen from "./LoginScreen";
import SocialLogin from "./components/social-button/SocialButton";

export { LoginScreen, SocialLogin };
export default LoginScreen;
export { SocialLogin };
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-login-screen",
"version": "3.0.2",
"version": "3.1.0",
"description": "Fully Customizable & Ready to use Login Screen for React Native",
"keywords": [
"login",
Expand Down

0 comments on commit 771e5c0

Please sign in to comment.