Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix mobile transaction form requires additional click to unfocus amount input #3274

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
bf965b1
Fix mobile transaction form requires additional click to unfocus amou…
minajevs Aug 16, 2024
4132141
remove console.logs
minajevs Aug 16, 2024
f159765
Release note
minajevs Aug 16, 2024
c902193
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Aug 18, 2024
a70a144
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Aug 25, 2024
04da995
Remove single active form hook
minajevs Aug 28, 2024
1890304
remove controlled focus from FocusableAmountInput
minajevs Aug 28, 2024
3951fad
fix optional prop
minajevs Aug 28, 2024
4c0d853
Remove erroneous import
minajevs Aug 28, 2024
b32ebdf
fix lint errors
minajevs Aug 28, 2024
7cd0e83
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Oct 14, 2024
ae3bfac
merge
minajevs Oct 14, 2024
adadf6f
fix lint
minajevs Oct 14, 2024
25ee4c3
apply suggestions
minajevs Oct 14, 2024
4ed0173
Fx issues
minajevs Oct 14, 2024
68f7326
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Oct 15, 2024
8d5990a
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Oct 18, 2024
358b4b2
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Nov 1, 2024
4599673
fix lint
minajevs Nov 1, 2024
0bc816d
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Nov 11, 2024
b24fa59
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Nov 19, 2024
7416f35
Fix merge
minajevs Nov 19, 2024
f54f830
Merge branch 'master' into dm-fix-second-click-on-mobile-new-transaction
minajevs Nov 27, 2024
2b6c9b1
fix merge lint
minajevs Nov 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -158,31 +158,36 @@ const AmountInput = memo(function AmountInput({
);
});

type FocusableAmountInputProps = Omit<AmountInputProps, 'onFocus'> & {
type FocusableAmountInputProps = Omit<
AmountInputProps,
'onFocus' | 'onBlur'
> & {
sign?: '+' | '-';
zeroSign?: '+' | '-';
focused?: boolean;
defaultFocused?: boolean;
disabled?: boolean;
focusedStyle?: CSSProperties;
buttonProps?: ComponentPropsWithRef<typeof Button>;
onFocus?: () => void;
};

export const FocusableAmountInput = memo(function FocusableAmountInput({
value,
sign,
zeroSign,
focused,
defaultFocused,
disabled,
textStyle,
style,
focusedStyle,
buttonProps,
onFocus,
onBlur,
...props
}: FocusableAmountInputProps) {
const [isNegative, setIsNegative] = useState(true);
const [focused, setFocused] = useState(defaultFocused ?? false);
minajevs marked this conversation as resolved.
Show resolved Hide resolved

useEffect(() => {
setFocused(defaultFocused ?? false);
}, [defaultFocused]);

const maybeApplyNegative = (amount: number, negative: boolean) => {
const absValue = Math.abs(amount);
Expand Down Expand Up @@ -215,8 +220,8 @@ export const FocusableAmountInput = memo(function FocusableAmountInput({
<AmountInput
{...props}
value={value}
onFocus={onFocus}
onBlur={onBlur}
onFocus={() => setFocused(true)}
onBlur={() => setFocused(false)}
minajevs marked this conversation as resolved.
Show resolved Hide resolved
onUpdateAmount={amount => onUpdateAmount(amount, isNegative)}
focused={focused && !disabled}
style={{
Expand Down Expand Up @@ -248,7 +253,7 @@ export const FocusableAmountInput = memo(function FocusableAmountInput({
</Button>
)}
<Button
onPress={onFocus}
onPress={() => setFocused(true)}
// Defines how far touch can start away from the button
// hitSlop={{ top: 5, bottom: 5, left: 5, right: 5 }}
{...buttonProps}
Expand Down
Loading
Loading