From 67981afac39be67de4fcae97826cee435ab1dc29 Mon Sep 17 00:00:00 2001 From: Ivan Chen Date: Fri, 7 May 2021 19:17:37 -0400 Subject: updated styling --- src/components/onboarding/ArrowButton.tsx | 4 +- src/screens/onboarding/BasicInfoOnboarding.tsx | 216 ++++++++++++++----------- src/screens/onboarding/PhoneVerification.tsx | 37 ++--- 3 files changed, 143 insertions(+), 114 deletions(-) (limited to 'src') diff --git a/src/components/onboarding/ArrowButton.tsx b/src/components/onboarding/ArrowButton.tsx index 78dbab32..dcf559a8 100644 --- a/src/components/onboarding/ArrowButton.tsx +++ b/src/components/onboarding/ArrowButton.tsx @@ -38,8 +38,8 @@ const ArrowButton: React.FC = (props) => { const styles = StyleSheet.create({ image: { - // width: '100%', - // height: '100%', + width: '100%', + height: '100%', }, }); diff --git a/src/screens/onboarding/BasicInfoOnboarding.tsx b/src/screens/onboarding/BasicInfoOnboarding.tsx index 277331b2..2152ffb9 100644 --- a/src/screens/onboarding/BasicInfoOnboarding.tsx +++ b/src/screens/onboarding/BasicInfoOnboarding.tsx @@ -11,10 +11,9 @@ import { StyleSheet, Text, TouchableOpacity, - View, } from 'react-native'; import {normalize} from 'react-native-elements'; -import Animated, {Easing} from 'react-native-reanimated'; +import Animated, {Easing, useValue} from 'react-native-reanimated'; import { ArrowButton, Background, @@ -41,7 +40,7 @@ import { import {OnboardingStackParams} from '../../routes'; import {sendOtpStatusCode, sendRegister} from '../../services'; import {BackgroundGradientType} from '../../types'; -import {SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; +import {HeaderHeight, SCREEN_HEIGHT, SCREEN_WIDTH} from '../../utils'; type BasicInfoOnboardingRouteProp = RouteProp< OnboardingStackParams, @@ -68,6 +67,7 @@ const BasicInfoOnboarding: React.FC = ({route}) => { const [fadeValue, setFadeValue] = useState>( new Animated.Value(0), ); + const fadeButtonValue = useValue(0); const [form, setForm] = useState({ fname: '', lname: '', @@ -77,19 +77,38 @@ const BasicInfoOnboarding: React.FC = ({route}) => { password: '', }); - const fadeComponentIn = async () => { - Animated.timing(fadeValue, { - toValue: 1, - duration: 1000, + const fadeFormIn = () => { + setFadeValue(new Animated.Value(0)); + }; + + const fadeButtonTo = (target: number) => { + Animated.timing(fadeButtonValue, { + toValue: target, + duration: 100, easing: Easing.linear, }).start(); }; useEffect(() => { - fadeComponentIn(); + const fade = async () => { + Animated.timing(fadeValue, { + toValue: 1, + duration: 1000, + easing: Easing.linear, + }).start(); + }; + fade(); }, [fadeValue]); - const goNext = async () => { + useEffect(() => { + if (valid) { + fadeButtonTo(1); + } else { + fadeButtonTo(0); + } + }, [valid]); + + const goToPhoneVerification = async () => { if (!attemptedSubmit) { setAttemptedSubmit(true); } @@ -262,7 +281,7 @@ const BasicInfoOnboarding: React.FC = ({route}) => { setCurrentStep(currentStep + 1); setAttemptedSubmit(false); setValid(false); - setFadeValue(new Animated.Value(0)); + fadeFormIn(); } }; const advanceRegistration = async () => { @@ -317,63 +336,70 @@ const BasicInfoOnboarding: React.FC = ({route}) => { style={styles.container} gradientType={BackgroundGradientType.Light}> - {/* getting rid of registration progress in onboarding*/} - {/* */} - - {currentStep !== 0 && currentStep !== 3 && ( - { - // if I go back do I want to reset the previous form? - setCurrentStep(currentStep - 1); - resetForm(step.placeholder); - setAttemptedSubmit(false); - }} - /> - )} - + {currentStep !== 0 && currentStep !== 3 && ( + { + // if I go back do I want to reset the previous form? + setCurrentStep(currentStep - 1); + resetForm(step.placeholder); + setAttemptedSubmit(false); + setFadeValue(new Animated.Value(0)); + }} + /> + )} {step.placeholder === 'Phone' && !isPhoneVerified ? ( - - - - + <> + + PHONE NUMBER + + + + + + + + ) : ( <> {step.placeholder !== 'Password' ? ( <> SIGN UP - + = ({route}) => { invalidWarning={`Please enter a valid ${step.placeholder.toLowerCase()}`} attemptedSubmit={attemptedSubmit} /> - + + + ) : ( - + = ({route}) => { setPassVisibility(!passVisibility)}> Show Password @@ -441,13 +471,15 @@ const BasicInfoOnboarding: React.FC = ({route}) => { accepted={tcAccepted} onChange={setTCAccepted} /> - + + + )} @@ -464,18 +496,27 @@ const styles = StyleSheet.create({ alignItems: 'center', justifyContent: 'center', }, + formContainer: { + marginTop: '20%', + height: SCREEN_HEIGHT * 0.2, + width: '80%', + justifyContent: 'space-between', + alignItems: 'center', + }, arrow: { color: '#6EE7E7', }, - showPass: { - color: 'white', + showPassContainer: { marginVertical: '1%', borderBottomWidth: 1, paddingBottom: '1%', - left: '-18%', + alignSelf: 'flex-start', borderBottomColor: 'white', marginBottom: '8%', }, + showPass: { + color: 'white', + }, passWarning: { fontSize: 14, marginTop: 5, @@ -484,7 +525,7 @@ const styles = StyleSheet.create({ alignSelf: 'flex-start', }, input: { - minWidth: '60%', + minWidth: '100%', height: 40, fontSize: 16, fontWeight: '600', @@ -511,7 +552,7 @@ const styles = StyleSheet.create({ fontSize: 30, fontWeight: '600', position: 'absolute', - top: '20%', + top: SCREEN_HEIGHT * 0.15, }, load: { top: '5%', @@ -519,19 +560,12 @@ const styles = StyleSheet.create({ tc: { marginVertical: '5%', }, - footer: { - height: normalize(50), - width: normalize(50), - flexDirection: 'row', - justifyContent: 'space-around', - ...Platform.select({ - ios: { - bottom: '20%', - }, - android: { - bottom: '10%', - }, - }), + backArrow: { + width: normalize(29), + height: normalize(25), + position: 'absolute', + top: HeaderHeight * 1.5, + left: 20, }, }); export default BasicInfoOnboarding; diff --git a/src/screens/onboarding/PhoneVerification.tsx b/src/screens/onboarding/PhoneVerification.tsx index 93ae8fdc..7d9a04d8 100644 --- a/src/screens/onboarding/PhoneVerification.tsx +++ b/src/screens/onboarding/PhoneVerification.tsx @@ -4,7 +4,6 @@ import React, {useMemo} from 'react'; import { Alert, KeyboardAvoidingView, - Platform, StyleSheet, TouchableOpacity, View, @@ -16,6 +15,7 @@ import { useBlurOnFulfill, useClearByFocusCell, } from 'react-native-confirmation-code-field'; +import {normalize} from 'react-native-elements'; import {trackPromise} from 'react-promise-tracker'; import { ArrowButton, @@ -31,6 +31,7 @@ import { import {OnboardingStackParams} from '../../routes'; import {sendOtp, verifyOtp} from '../../services'; import {BackgroundGradientType} from '../../types'; +import {HeaderHeight} from '../../utils'; type PhoneVerificationRouteProp = RouteProp< OnboardingStackParams, @@ -75,14 +76,14 @@ const PhoneVerification: React.FC = ({ const footer = useMemo( () => ( - - - navigation.navigate('BasicInfoOnboarding', {isPhoneVerified: false}) - } - /> - + + navigation.navigate('BasicInfoOnboarding', {isPhoneVerified: false}) + } + /> ), [], ); @@ -201,18 +202,12 @@ const styles = StyleSheet.create({ loadingIndicator: { marginVertical: '5%', }, - footer: { - width: '100%', - flexDirection: 'row', - justifyContent: 'space-around', - ...Platform.select({ - ios: { - bottom: '20%', - }, - android: { - bottom: '10%', - }, - }), + backArrow: { + width: normalize(29), + height: normalize(25), + position: 'absolute', + top: HeaderHeight * 1.5, + left: 20, }, }); export default PhoneVerification; -- cgit v1.2.3-70-g09d2