From 70000a49ea00e48e6c81c5184dc1d42d8f0cbff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Ska=C5=82ka?= Date: Thu, 17 Aug 2023 08:31:53 +0200 Subject: [PATCH] review changes --- src/components/PDFView/PDFPasswordForm.js | 8 ++++---- src/styles/styles.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/components/PDFView/PDFPasswordForm.js b/src/components/PDFView/PDFPasswordForm.js index 109bc6facdf3..3a7814684ebb 100644 --- a/src/components/PDFView/PDFPasswordForm.js +++ b/src/components/PDFView/PDFPasswordForm.js @@ -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'; @@ -50,7 +50,7 @@ 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'); } @@ -58,7 +58,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid, shouldShowLoadingIndicat return translate(validationErrorText); } return ''; - })(); + }, [isPasswordInvalid, translate, validationErrorText]); useEffect(() => { if (!isFocused) { @@ -103,7 +103,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid, shouldShowLoadingIndicat return shouldShowForm ? ( diff --git a/src/styles/styles.js b/src/styles/styles.js index 3105ac0f6b41..796af532f136 100644 --- a/src/styles/styles.js +++ b/src/styles/styles.js @@ -2107,7 +2107,7 @@ const styles = { outline: 'none', }, - pdfPasswordForm: (isSmallScreenWidth) => ({ + getPDFPasswordFormStyle: (isSmallScreenWidth) => ({ width: isSmallScreenWidth ? '100%' : 350, ...(isSmallScreenWidth && flex.flex1), }),