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
7 changes: 5 additions & 2 deletions src/components/AnimatedSubmitButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Button from '@components/Button';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useLocalize from '@hooks/useLocalize';
import useOnyx from '@hooks/useOnyx';
import useStyleUtils from '@hooks/useStyleUtils';
import useThemeStyles from '@hooks/useThemeStyles';

import variables from '@styles/variables';
Expand All @@ -17,6 +18,7 @@ import type WithSentryLabel from '@src/types/utils/SentryLabel';
import type {OnyxEntry} from 'react-native-onyx';

import React, {useEffect, useState} from 'react';
import {View} from 'react-native';
import Animated, {css, useReducedMotion} from 'react-native-reanimated';

type AnimatedSubmitButtonProps = WithSentryLabel & {
Expand Down Expand Up @@ -124,10 +126,11 @@ function SubmittingButton({variant, text, onAnimationFinish, shouldShowMarkAsDon

function AnimatedSubmitButton({isSubmittingAnimationRunning, onPress, isDisabled, sentryLabel, ...props}: AnimatedSubmitButtonProps) {
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
const [pendingExpenseAction] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_METADATA}${props.reportID}`, {selector: pendingExpenseActionSelector});

return (
Comment thread
roryabraham marked this conversation as resolved.
Resolved
<Animated.View style={[styles.justifyContentCenter, {height: variables.componentSizeNormal}]}>
<View style={[styles.justifyContentCenter, StyleUtils.getHeight(variables.componentSizeNormal)]}>
{isSubmittingAnimationRunning ? (
<SubmittingButton
key={`${props.reportID}:${props.isDEWSubmission ? 'dew' : 'standard'}`}
Expand All @@ -144,7 +147,7 @@ function AnimatedSubmitButton({isSubmittingAnimationRunning, onPress, isDisabled
<Button.Text>{props.text}</Button.Text>
</Button>
)}
</Animated.View>
</View>
);
}

Expand Down
3 changes: 1 addition & 2 deletions tests/ui/components/AnimatedSubmitButtonTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ jest.mock('react-native-reanimated', () => {
...actual.default,
View: jest.fn((props: React.ComponentProps<typeof WebView>) => <WebView {...props} />),
},
// Jest does not compile app worklets. Keep the real web hook with explicit dependencies.
useAnimatedStyle: (updater: Parameters<typeof actual.useAnimatedStyle>[0]) => actual.useAnimatedStyle(updater, [updater]),
useReducedMotion: jest.fn(() => false),
};
});
Expand All @@ -46,6 +44,7 @@ jest.mock('react-native-reanimated/src/createAnimatedComponent/AnimatedComponent
);
jest.mock('@hooks/useOnyx', () => jest.fn(() => [mockPendingExpenseAction]));
jest.mock('@hooks/useThemeStyles', () => jest.fn(() => ({justifyContentCenter: {justifyContent: 'center'}})));
jest.mock('@hooks/useStyleUtils', () => jest.fn(() => ({getHeight: (height: number) => ({height})})));
jest.mock('@hooks/useLocalize', () => jest.fn(() => ({translate: (key: string) => key})));
jest.mock('@hooks/useLazyAsset', () => ({
useMemoizedLazyExpensifyIcons: () => ({Send: () => null}),
Expand Down
Loading