fixed header not hiding on android on login screen when keyboard is active

This commit is contained in:
Sadaqat Ali 2022-07-23 22:19:09 +05:00
parent 9443000049
commit 0a064fc56b
3 changed files with 14 additions and 3 deletions

View File

@ -26,6 +26,7 @@ interface Props extends TextInputProps {
inputStyle:TextStyle;
isValid:boolean;
onChange?:(value:string)=>void;
handleFocus?:(value:boolean)=>void;
}
const FormInputView = ({
@ -44,6 +45,7 @@ const FormInputView = ({
isValid,
value,
onBlur,
handleFocus,
...props
}:Props) => {
const [_value, setValue] = useState(value || '');
@ -62,11 +64,16 @@ const FormInputView = ({
const _handleOnFocus = () => {
setInputBorderColor('#357ce6');
if(handleFocus){
handleFocus(true);
}
};
const _handleOnBlur = () => {
setInputBorderColor('#e7e7e7');
if(handleFocus){
handleFocus(false);
}
if (onBlur) {
onBlur();
}

View File

@ -48,6 +48,7 @@ export default EStyleSheet.create({
flexDirection: 'row',
justifyContent: 'space-between',
backgroundColor: '$primaryBackgroundColor',
paddingVertical: 8,
},
logo: {
width: 32,

View File

@ -62,6 +62,9 @@ class LoginScreen extends PureComponent {
this.setState({ isModalOpen: !isModalOpen });
};
_handleFormInputFocus = (isFocused) => {
this.setState({ keyboardIsOpen: isFocused });
};
render() {
const { navigation, intl, handleOnPressLogin, handleSignUp, isLoading } = this.props;
const { username, isUsernameValid, keyboardIsOpen, password, isModalOpen } = this.state;
@ -102,8 +105,6 @@ class LoginScreen extends PureComponent {
style={styles.tabbarItem}
>
<KeyboardAwareScrollView
onKeyboardWillShow={() => this.setState({ keyboardIsOpen: true })}
onKeyboardWillHide={() => this.setState({ keyboardIsOpen: false })}
enableAutoAutomaticScroll={Platform.OS === 'ios'}
contentContainerStyle={styles.formWrapper}
enableOnAndroid={true}
@ -122,6 +123,7 @@ class LoginScreen extends PureComponent {
isFirstImage
value={username}
inputStyle={styles.input}
handleFocus={this._handleFormInputFocus}
/>
<FormInput
rightIconName="lock"
@ -136,6 +138,7 @@ class LoginScreen extends PureComponent {
type="password"
numberOfLines={1}
inputStyle={styles.input}
handleFocus={this._handleFormInputFocus}
/>
<InformationArea
description={intl.formatMessage({