Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed Aug 17, 2023
1 parent e0eb0ce commit 70000a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/components/PDFView/PDFPasswordForm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'underscore';
import React, {useState, useRef, useEffect} from 'react';
import React, {useState, useRef, useEffect, useMemo} from 'react';
import PropTypes from 'prop-types';
import {View, ScrollView} from 'react-native';
import Button from '../Button';
Expand Down Expand Up @@ -50,15 +50,15 @@ function PDFPasswordForm({isFocused, isPasswordInvalid, shouldShowLoadingIndicat
const [shouldShowForm, setShouldShowForm] = useState(false);
const textInputRef = useRef(null);

const errorText = (() => {
const errorText = useMemo(() => {
if (isPasswordInvalid) {
return translate('attachmentView.passwordIncorrect');
}
if (!_.isEmpty(validationErrorText)) {
return translate(validationErrorText);
}
return '';
})();
}, [isPasswordInvalid, translate, validationErrorText]);

useEffect(() => {
if (!isFocused) {
Expand Down Expand Up @@ -103,7 +103,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid, shouldShowLoadingIndicat
return shouldShowForm ? (
<ScrollView
keyboardShouldPersistTaps="handled"
style={styles.pdfPasswordForm(isSmallScreenWidth)}
style={styles.getPDFPasswordFormStyle(isSmallScreenWidth)}
contentContainerStyle={styles.p5}
>
<View style={styles.mb4}>
Expand Down
2 changes: 1 addition & 1 deletion src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -2107,7 +2107,7 @@ const styles = {
outline: 'none',
},

pdfPasswordForm: (isSmallScreenWidth) => ({
getPDFPasswordFormStyle: (isSmallScreenWidth) => ({
width: isSmallScreenWidth ? '100%' : 350,
...(isSmallScreenWidth && flex.flex1),
}),
Expand Down

0 comments on commit 70000a4

Please sign in to comment.