From f0a87b818be871bcfc72a467c58d4e1ff2a109ef Mon Sep 17 00:00:00 2001 From: Anita Date: Wed, 25 Jun 2025 16:22:02 +0530 Subject: [PATCH] lineargradient add --- package.json | 2 + src/components/Background.js | 28 +++++++++ src/components/CustomButton.js | 2 +- src/components/CustomTextInput.js | 86 +++++++++++++++++++++++++++ src/screens/AuthScreen/Login/index.js | 57 +++++++++++++++--- src/screens/AuthScreen/Login/style.js | 46 ++++++++++++++ src/theme/index.js | 3 +- src/theme/theme.js | 13 +++- yarn.lock | 20 ++++++- 9 files changed, 244 insertions(+), 13 deletions(-) create mode 100644 src/components/Background.js create mode 100644 src/components/CustomTextInput.js diff --git a/package.json b/package.json index df6f81d..398d6e7 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,8 @@ "react-native": "0.80.0", "react-native-chart-kit": "^6.12.0", "react-native-element-dropdown": "^2.12.4", + "react-native-keyboard-aware-scroll-view": "^0.9.5", + "react-native-linear-gradient": "^2.8.3", "react-native-otp-textinput": "^1.1.7", "react-native-safe-area-context": "^5.5.0", "react-native-screens": "^4.11.1", diff --git a/src/components/Background.js b/src/components/Background.js new file mode 100644 index 0000000..9d5b240 --- /dev/null +++ b/src/components/Background.js @@ -0,0 +1,28 @@ +// src/components/Background.js + +import React from 'react'; +import { StyleSheet, SafeAreaView, StatusBar } from 'react-native'; +import LinearGradient from 'react-native-linear-gradient'; + +const Background = ({ children, barcolor = 'light-content', gradientColors = ['#4c669f', '#3b5998', '#192f6a'] }) => { + return ( + + + + {children} + + + ); +}; + +const styles = StyleSheet.create({ + container: { + flex: 1, + }, + gradient: { + flex: 1, + paddingHorizontal: 16, // optional padding + }, +}); + +export default Background; diff --git a/src/components/CustomButton.js b/src/components/CustomButton.js index 75ca154..70bc60f 100644 --- a/src/components/CustomButton.js +++ b/src/components/CustomButton.js @@ -3,7 +3,7 @@ import { View, Text, Pressable } from 'react-native'; const CustomButton = ({title,style,textstyle,onPress}) => { return ( - + {title} diff --git a/src/components/CustomTextInput.js b/src/components/CustomTextInput.js new file mode 100644 index 0000000..bd5c949 --- /dev/null +++ b/src/components/CustomTextInput.js @@ -0,0 +1,86 @@ +import {View,Text,TextInput,StyleSheet,} from 'react-native'; +import React, {useState} from 'react'; +import {GlobalTheme} from '../theme'; + +const CustomTextInput = ({ + label, + value, + onChangeText, + keyboardType, + secureTextEntry, + right, + textstyle, + viewstyle, + maxLength +}) => { + const [isFocused, setFocused] = useState(false); + const [hidepassword, setHidePassword] = useState(false); + + const handleFocus = () => { + setFocused(true); + }; + + const handleBlur = () => { + setFocused(false); + }; + + const inputStyle = { + borderColor: isFocused ? '#2680EB' : 'transparent', + borderWidth: 2, + backgroundColor: isFocused ? '#FFF' : '#F1F1F1', + borderRadius: GlobalTheme.borderRadius.md, + }; + + return ( + + + {label} + + + + + + + ); +}; + +export default CustomTextInput; + +const styles = StyleSheet.create({ + input: { + height: 50, + borderWidth: 1, + padding: 10, + borderRadius: 4, + color: GlobalTheme.colors.black, + }, + inputContainer: { + marginBottom: 16, + }, +}); diff --git a/src/screens/AuthScreen/Login/index.js b/src/screens/AuthScreen/Login/index.js index 1a0ea57..c3125f5 100644 --- a/src/screens/AuthScreen/Login/index.js +++ b/src/screens/AuthScreen/Login/index.js @@ -1,12 +1,51 @@ -import { View, Text } from 'react-native' -import React from 'react' +import React, { useState } from 'react'; +import { View, Text, Image, Alert } from 'react-native'; +import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; +import IMAGES from '../../../constants/Images'; +import { styles } from './style'; +import AsyncStorage from '@react-native-async-storage/async-storage'; +import { useDispatch } from 'react-redux'; +import CustomTextInput from '../../../components/CustomTextInput'; +import CustomButton from '../../../components/CustomButton'; +import { GlobalTheme } from '../../../theme'; +import Background from '../../../components/Background'; -const Login = () => { - return ( - - Login +const Login = ({ navigation }) => { + const [loading, setLoading] = useState(false); + const dispatch = useDispatch(); + + const [username, setUsername] = useState(''); + + return ( + + + + - ) -} -export default Login \ No newline at end of file + + Log In + + + + + + + + + + + + + ); +}; + +export default Login; diff --git a/src/screens/AuthScreen/Login/style.js b/src/screens/AuthScreen/Login/style.js index e69de29..115044f 100644 --- a/src/screens/AuthScreen/Login/style.js +++ b/src/screens/AuthScreen/Login/style.js @@ -0,0 +1,46 @@ +import {StyleSheet} from 'react-native'; + +import { GlobalTheme , Screen } from '../../../theme'; + +export const styles = StyleSheet.create({ + container: { + // flex: 1, + backgroundColor: GlobalTheme.colors.white, + paddingHorizontal: 10, + }, + logoContainer: { + alignItems: 'center', + paddingTop: 40, + }, + appLogo: { + height :200 , + width :200, + resizeMode: 'contain', + }, + appMaskLogo: { + resizeMode: 'stretch', + width: Screen.screenHeight * 0.9, + height: Screen.screenHeight * 0.33, + }, + titleContainer: { + alignSelf: 'center', + // marginTop: 15, + }, + titleText: { + fontSize: 25, + fontWeight: 'bold', + color: GlobalTheme.colors.black, + }, + subtitleText: { + fontSize: 15, + color: '#1F2128', + marginBottom: 14, + fontWeight: '600', + alignSelf: 'center', + width: '80%', + textAlign: 'center', + }, + subtitleHighlight: { + color: '#2381E9', + }, +}); diff --git a/src/theme/index.js b/src/theme/index.js index 74924a7..aa97e5f 100644 --- a/src/theme/index.js +++ b/src/theme/index.js @@ -1,3 +1,4 @@ import GlobalTheme from './theme'; +import { shadow , Screen } from './theme'; -export {GlobalTheme, metrics}; +export {GlobalTheme, Screen , shadow}; diff --git a/src/theme/theme.js b/src/theme/theme.js index fa2151a..a598c7e 100644 --- a/src/theme/theme.js +++ b/src/theme/theme.js @@ -1,8 +1,19 @@ +import { Dimensions, Platform } from 'react-native'; + +const { width: screenWidth, height: screenHeight } = Dimensions.get('window'); + +export const Screen = { + screenWidth, + screenHeight, + isAndroid: Platform.OS === 'android', + isIOS: Platform.OS === 'ios', +}; + const GlobalTheme = { colors: { // Primary Colors primary: '#113F8C', // Main color for buttons, headers - secondary: '#4472BE', + secondary: '#2357C6', text: '#333333', // Text color for most content lightblue:'#EAF1FF', lightblueborder:'#C6DBFF24', diff --git a/yarn.lock b/yarn.lock index 51d0f2c..f65251d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5590,7 +5590,7 @@ prompts@^2.0.1, prompts@^2.4.2: kleur "^3.0.3" sisteransi "^1.0.5" -prop-types@^15.7.2, prop-types@^15.8.1: +prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -5707,11 +5707,29 @@ react-native-element-dropdown@^2.12.4: dependencies: lodash "^4.17.21" +react-native-iphone-x-helper@^1.0.3: + version "1.3.1" + resolved "https://registry.yarnpkg.com/react-native-iphone-x-helper/-/react-native-iphone-x-helper-1.3.1.tgz#20c603e9a0e765fd6f97396638bdeb0e5a60b010" + integrity sha512-HOf0jzRnq2/aFUcdCJ9w9JGzN3gdEg0zFE4FyYlp4jtidqU03D5X7ZegGKfT1EWteR0gPBGp9ye5T5FvSWi9Yg== + react-native-is-edge-to-edge@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/react-native-is-edge-to-edge/-/react-native-is-edge-to-edge-1.1.7.tgz#28947688f9fafd584e73a4f935ea9603bd9b1939" integrity sha512-EH6i7E8epJGIcu7KpfXYXiV2JFIYITtq+rVS8uEb+92naMRBdxhTuS8Wn2Q7j9sqyO0B+Xbaaf9VdipIAmGW4w== +react-native-keyboard-aware-scroll-view@^0.9.5: + version "0.9.5" + resolved "https://registry.yarnpkg.com/react-native-keyboard-aware-scroll-view/-/react-native-keyboard-aware-scroll-view-0.9.5.tgz#e2e9665d320c188e6b1f22f151b94eb358bf9b71" + integrity sha512-XwfRn+T/qBH9WjTWIBiJD2hPWg0yJvtaEw6RtPCa5/PYHabzBaWxYBOl0usXN/368BL1XktnZPh8C2lmTpOREA== + dependencies: + prop-types "^15.6.2" + react-native-iphone-x-helper "^1.0.3" + +react-native-linear-gradient@^2.8.3: + version "2.8.3" + resolved "https://registry.yarnpkg.com/react-native-linear-gradient/-/react-native-linear-gradient-2.8.3.tgz#9a116649f86d74747304ee13db325e20b21e564f" + integrity sha512-KflAXZcEg54PXkLyflaSZQ3PJp4uC4whM7nT/Uot9m0e/qxFV3p6uor1983D1YOBJbJN7rrWdqIjq0T42jOJyA== + react-native-otp-textinput@^1.1.7: version "1.1.7" resolved "https://registry.yarnpkg.com/react-native-otp-textinput/-/react-native-otp-textinput-1.1.7.tgz#c7c3611c35701996777d117a1990c58ca94796da"