From d0c0c2c41564a8c7468d39356c8015eb2f268943 Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Tue, 8 Jan 2019 11:41:09 +0100 Subject: [PATCH] autofocus on input only if autoFocus prop is present --- src/components/SelectCurrency/index.js | 12 +++++++++++- src/components/base/Select/index.js | 7 ++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/components/SelectCurrency/index.js b/src/components/SelectCurrency/index.js index 0ba3bab4..97823765 100644 --- a/src/components/SelectCurrency/index.js +++ b/src/components/SelectCurrency/index.js @@ -18,6 +18,7 @@ type OwnProps = { currencies?: CryptoCurrency[], value?: CryptoCurrency, placeholder: string, + autoFocus?: boolean, t: T, } @@ -29,12 +30,21 @@ const mapStateToProps = (state, props: OwnProps) => ({ currencies: props.currencies || availableCurrencies(state), }) -const SelectCurrency = ({ onChange, value, t, placeholder, currencies, ...props }: Props) => { +const SelectCurrency = ({ + onChange, + value, + t, + placeholder, + currencies, + autoFocus, + ...props +}: Props) => { const options = currencies ? currencies.map(c => ({ ...c, value: c.id, label: c.name, currency: c })) : [] return (