Compare commits

...

4 Commits

Author SHA1 Message Date
sundasnoreen12
9c3b7a6755 Revert "feat: implemented restricted countires"
This reverts commit ffe306b60f.
2025-02-22 15:52:06 +05:00
sundasnoreen12
ffe306b60f feat: implemented restricted countires 2025-02-22 15:36:07 +05:00
sundasnoreen12
30980242a3 fix: remove check for floating label 2025-02-22 15:35:58 +05:00
sundasnoreen12
83ad419a39 fix: fixed logistration page placeholder issue 2025-02-22 15:35:58 +05:00
2 changed files with 41 additions and 3 deletions

View File

@@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useEffect, useRef, useState } from 'react';
import {
Form, TransitionReplace,
@@ -7,9 +7,34 @@ import PropTypes from 'prop-types';
const FormGroup = (props) => {
const [hasFocus, setHasFocus] = useState(false);
const [inputValue, setInputValue] = useState(props.value || '');
const valueRef = useRef('');
useEffect(() => {
const input = document.getElementsByName(props.name)[0];
if (!input) { return undefined; }
const updateValue = () => {
if (input.value && input.value !== valueRef.current) {
valueRef.current = input.value;
setInputValue(input.value);
}
};
requestAnimationFrame(updateValue); // Detect autofill on page load
input.addEventListener('input', updateValue);
input.addEventListener('focus', updateValue);
return () => {
input.removeEventListener('input', updateValue);
input.removeEventListener('focus', updateValue);
};
}, [props.name]);
const handleFocus = (e) => {
setHasFocus(true);
setInputValue(inputValue || '');
if (props.handleFocus) { props.handleFocus(e); }
};
const handleClick = (e) => {
@@ -19,6 +44,10 @@ const FormGroup = (props) => {
setHasFocus(false);
if (props.handleBlur) { props.handleBlur(e); }
};
const handleChange = (e) => {
setInputValue(e.target.value);
if (props.handleChange) { props.handleChange(e); }
};
return (
<Form.Group controlId={props.name} className={props.className} isInvalid={props.errorMessage !== ''}>
@@ -31,11 +60,11 @@ const FormGroup = (props) => {
autoComplete={props.autoComplete}
spellCheck={props.spellCheck}
name={props.name}
value={props.value}
value={inputValue}
onFocus={handleFocus}
onBlur={handleOnBlur}
onClick={handleClick}
onChange={props.handleChange}
onChange={handleChange}
controlClassName={props.borderClass}
trailingElement={props.trailingElement}
floatingLabel={props.floatingLabel}

View File

@@ -618,6 +618,15 @@ describe('RegistrationPage', () => {
...initialState,
register: {
...initialState.register,
registrationFormData: {
...registrationFormData,
formFields: {
name: 'test',
username: 'test',
email: 'test@example.com',
password: 'test',
},
},
backedUpFormData: { ...registrationFormData },
},
commonComponents: {