| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- import { useState } from 'react';
- import {
- View,
- Text,
- StyleSheet,
- TouchableWithoutFeedback,
- Keyboard
- } from 'react-native';
- import ResetSuccessful from './formPages/resetSuccessful';
- import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view';
- import ForgetPasswordPage from './formPages/forgetPasswordPage';
- import { forgetPasswordFormData } from '../../../types/signup';
- type ForgetPasswordFormProps = {
- forgetPasswordFormData: forgetPasswordFormData;
- setForgetPasswordFormData: React.Dispatch<
- React.SetStateAction<forgetPasswordFormData>
- >;
- };
- const ForgetPasswordForm: React.FC<ForgetPasswordFormProps> = ({
- forgetPasswordFormData,
- setForgetPasswordFormData
- }) => {
- const [screen, setScreen] = useState<number>(0);
- const FormTitle = ['忘記密碼 - 電話驗證'];
- const ScreenDisplay = () => {
- switch (screen) {
- case 0:
- return (
- <ForgetPasswordPage
- forgetPasswordFormData={forgetPasswordFormData}
- setForgetPasswordFormData={setForgetPasswordFormData}
- setScreen={setScreen}
- />
- );
- case 1:
- return <ResetSuccessful />;
- default:
- return <></>;
- }
- };
- return (
- <>
- <KeyboardAwareScrollView
- enableOnAndroid={true}
- resetScrollToCoords={{ x: 0, y: 0 }}
- style={{
- height: "100%"
- }}
- >
- {screen === 0 && (
- <View style={styles.topContainer}>
- <Text style={styles.text}>{FormTitle[screen]}</Text>
- <View style={styles.breakline} />
- </View>
- )}
- <View style={styles.bottomContainer}>{ScreenDisplay()}</View>
- </KeyboardAwareScrollView>
- </>
- );
- };
- const styles = StyleSheet.create({
- topContainer: {
- flex: 1,
- alignItems: 'center',
- justifyContent: 'center',
- paddingBottom: '25%',
- paddingTop: '15%'
- },
- previouspageAndPaginationWrapper: {
- display: 'flex',
- width: '100%',
- flexDirection: 'row',
- justifyContent: 'space-between',
- alignItems: 'center',
- paddingHorizontal: 25
- },
- bottomContainer: { flex: 1 },
- breakline: {
- width: 24,
- height: 1,
- backgroundColor: '#000000',
- marginVertical: 17
- },
- text: { fontSize: 24, fontWeight: '300' }
- });
- export default ForgetPasswordForm;
|