Skip to content

Commit

Permalink
Merge pull request Expensify#43544 from tienifr/fix/42667
Browse files Browse the repository at this point in the history
fix Invisible send button above keyboard
  • Loading branch information
dangrous authored Jun 18, 2024
2 parents cceb345 + de626ee commit eb09f20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
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

0 comments on commit eb09f20

Please sign in to comment.