mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-09 03:32:54 -05:00
🐛 Mobile entry will enter positive value instead of negative (#1551)
Ensure our FocusableAmountInput used in MobileTransaction conditionally applies negation logic the same way onChange as it does onBlur.
This commit is contained in:
@@ -227,14 +227,18 @@ export class FocusableAmountInput extends PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
maybeApplyNegative = value => {
|
||||
const absValue = Math.abs(value);
|
||||
return this.state.isNegative ? -absValue : absValue;
|
||||
};
|
||||
|
||||
onBlur = value => {
|
||||
this.setState({ focused: false, reallyFocused: false });
|
||||
if (this.props.onBlur) {
|
||||
const absValue = Math.abs(value);
|
||||
this.props.onBlur(this.state.isNegative ? -absValue : absValue);
|
||||
}
|
||||
this.props.onBlur?.(this.maybeApplyNegative(value));
|
||||
};
|
||||
|
||||
onChange = value => this.props.onChange?.(this.maybeApplyNegative(value));
|
||||
|
||||
render() {
|
||||
const { textStyle, style, focusedStyle, buttonProps } = this.props;
|
||||
const { focused } = this.state;
|
||||
@@ -244,6 +248,7 @@ export class FocusableAmountInput extends PureComponent {
|
||||
<AmountInput
|
||||
{...this.props}
|
||||
ref={el => (this.amount = el)}
|
||||
onChange={this.onChange}
|
||||
onBlur={this.onBlur}
|
||||
focused={focused}
|
||||
style={[
|
||||
|
||||
6
upcoming-release-notes/1551.md
Normal file
6
upcoming-release-notes/1551.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
category: Bugfix
|
||||
authors: [trevdor]
|
||||
---
|
||||
|
||||
Mobile: transaction entry screen should apply the same negative/positive logic to Amount whether or not it is focused for editing at the time Add Transaction is pressed.
|
||||
Reference in New Issue
Block a user