Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 2 additions & 25 deletions src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import * as FileUtils from '@libs/fileDownload/FileUtils';
import Navigation from '@libs/Navigation/Navigation';
import * as ReportActionsUtils from '@libs/ReportActionsUtils';
import * as TransactionUtils from '@libs/TransactionUtils';
import useNativeDriver from '@libs/useNativeDriver';
import type {AvatarSource} from '@libs/UserUtils';
import variables from '@styles/variables';
import * as IOU from '@userActions/IOU';
Expand Down Expand Up @@ -359,28 +358,6 @@ function AttachmentModal({
[isValidFile, getModalType, isDirectoryCheck],
);

/**
* In order to gracefully hide/show the confirm button when the keyboard
* opens/closes, apply an animation to fade the confirm button out/in. And since
* we're only updating the opacity of the confirm button, we must also conditionally
* disable it.
*
* @param shouldFadeOut If true, fade out confirm button. Otherwise fade in.
*/
const updateConfirmButtonVisibility = useCallback(
(shouldFadeOut: boolean) => {
setIsConfirmButtonDisabled(shouldFadeOut);
const toValue = shouldFadeOut ? 0 : 1;

Animated.timing(confirmButtonFadeAnimation, {
toValue,
duration: 100,
useNativeDriver,
}).start();
},
[confirmButtonFadeAnimation],
);

/**
* close the modal
*/
Expand Down Expand Up @@ -547,7 +524,7 @@ function AttachmentModal({
source={sourceForAttachmentView}
isAuthTokenRequired={isAuthTokenRequiredState}
file={file}
onToggleKeyboard={updateConfirmButtonVisibility}
onToggleKeyboard={setIsConfirmButtonDisabled}
isWorkspaceAvatar={isWorkspaceAvatar}
maybeIcon={maybeIcon}
fallbackSource={fallbackSource}
Expand All @@ -559,7 +536,7 @@ function AttachmentModal({
))}
</View>
{/* If we have an onConfirm method show a confirmation button */}
{!!onConfirm && (
{!!onConfirm && !isConfirmButtonDisabled && (
<SafeAreaConsumer>
{({safeAreaPaddingBottomStyle}) => (
<Animated.View style={[StyleUtils.fade(confirmButtonFadeAnimation), safeAreaPaddingBottomStyle]}>
Expand Down
1 change: 0 additions & 1 deletion src/components/PDFView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ function PDFView({onToggleKeyboard, fileName, onPress, isFocused, sourceURL, max
isPasswordInvalid={isPasswordInvalid}
onSubmit={onSubmit}
onPasswordUpdated={onPasswordChange}
onPasswordFieldFocused={toggleKeyboardOnSmallScreens}
/>
)}
/>
Expand Down