Skip to content

Commit

Permalink
use anonymous function for onSelectionChange
Browse files Browse the repository at this point in the history
  • Loading branch information
akinwale committed Aug 28, 2023
1 parent a88c1b3 commit 998e56c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/components/TextInputWithCurrencySymbol/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@ function TextInputWithCurrencySymbol(props) {
setSkipNextSelectionChange(true);
}, [props.formattedAmount]);

const onSelectionChange = (e) => {
if (skipNextSelectionChange) {
setSkipNextSelectionChange(false);
return;
}
props.onSelectionChange(e);
};

return (
<BaseTextInputWithCurrencySymbol
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
onSelectionChange={onSelectionChange}
onSelectionChange={(e) => {
if (skipNextSelectionChange) {
setSkipNextSelectionChange(false);
return;
}
props.onSelectionChange(e);
}}
/>
);
}
Expand Down

0 comments on commit 998e56c

Please sign in to comment.