From fcbe52cdea22462d710a463b33a0ff52479a6059 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Fri, 21 Sep 2018 19:20:58 -0600 Subject: [PATCH 1/2] auto focus modal form-fields --- .../common/form-components/form-field.jsx | 18 +++++++++++++++++- src/renderer/component/walletSendTip/view.jsx | 1 + src/renderer/modal/modalWalletEncrypt/view.jsx | 1 + src/renderer/modal/modalWalletUnlock/view.jsx | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/renderer/component/common/form-components/form-field.jsx b/src/renderer/component/common/form-components/form-field.jsx index e2e1960d0..acecfac5d 100644 --- a/src/renderer/component/common/form-components/form-field.jsx +++ b/src/renderer/component/common/form-components/form-field.jsx @@ -24,12 +24,27 @@ type Props = { stretch?: boolean, affixClass?: string, // class applied to prefix/postfix label firstInList?: boolean, // at the top of a list, no padding top + autoFocus?: boolean, inputProps: { disabled?: boolean, }, }; export class FormField extends React.PureComponent { + constructor(props) { + super(props); + this.input = React.createRef(); + } + + componentDidMount() { + const { autoFocus } = this.props; + const input = this.input.current; + + if (input && autoFocus) { + input.focus(); + } + } + render() { const { render, @@ -43,6 +58,7 @@ export class FormField extends React.PureComponent { children, stretch, affixClass, + autoFocus, ...inputProps } = this.props; @@ -82,7 +98,7 @@ export class FormField extends React.PureComponent { } else if (type === 'checkbox') { input = ; } else { - input = ; + input = ; } } diff --git a/src/renderer/component/walletSendTip/view.jsx b/src/renderer/component/walletSendTip/view.jsx index 779ec2010..92246d912 100644 --- a/src/renderer/component/walletSendTip/view.jsx +++ b/src/renderer/component/walletSendTip/view.jsx @@ -83,6 +83,7 @@ class WalletSendTip extends React.PureComponent {
{ { Date: Fri, 21 Sep 2018 19:39:24 -0600 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0856356be..ab35e4285 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ## [Unreleased] ### Added +* Allow typing of encryption password without clicking entry box ([#1977](https://github.com/lbryio/lbry-desktop/pull/1977)) ### Changed @@ -37,7 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). * Desktop notification when publish is completed ([#1892](https://github.com/lbryio/lbry-desktop/pull/1892)) * FAQ to Publishing Area ([#1833](https://github.com/lbryio/lbry-desktop/pull/1833)) * FAQ to wallet security area ([#1917](https://github.com/lbryio/lbry-desktop/pull/1917)) - + ### Changed * Upgraded LBRY Protocol to [version 0.21.2](https://github.com/lbryio/lbry/releases/tag/v0.21.2) fixing a download bug. * Searching now shows results by default, including direct lbry:// URL tile ([#1875](https://github.com/lbryio/lbry-desktop/pull/)) -- 2.45.3