Skip to content

Commit

Permalink
Fix focus
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Sep 6, 2023
1 parent f4c02fb commit a01c1f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component, PureComponent, useState } from 'react';
import React, { Component, PureComponent, useRef, useState } from 'react';
// import {
// RectButton,
// PanGestureHandler,
Expand Down Expand Up @@ -120,15 +120,10 @@ function BudgetCell(props) {
onEdit?.(categoryId);
}

function inputRef(inputRef) {
inputRef?.select();
}

return (
<View style={style} onPointerUp={onAmountClick}>
{editing ? (
<AmountInput
inputRef={inputRef}
initialValue={sheetValue}
style={{
height: ROW_HEIGHT - 4,
Expand Down
2 changes: 2 additions & 0 deletions packages/desktop-client/src/components/util/AmountInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export function AmountInput({
onChange,
style,
textStyle,
focused,
}) {
let [negative, setNegative] = useState(initialValue <= 0);
let initialValueAbsolute = integerToCurrency(Math.abs(initialValue || 0));
Expand Down Expand Up @@ -62,6 +63,7 @@ export function AmountInput({
</Button>
}
value={value}
focused={focused}
style={{ flex: 1, alignItems: 'stretch', ...style }}
inputStyle={{ paddingLeft: 0, ...textStyle }}
onKeyUp={e => {
Expand Down

0 comments on commit a01c1f4

Please sign in to comment.