aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/components/hex-as-decimal-input.js
diff options
context:
space:
mode:
authorDan Finlay <dan@danfinlay.com>2017-03-24 07:02:40 +0800
committerDan Finlay <dan@danfinlay.com>2017-03-24 07:02:40 +0800
commit3400ed0955b7f31ddb0be182736fc1e7ae20d4da (patch)
tree6c87930015faad9620176a6a1f8248a0ff353bd3 /ui/app/components/hex-as-decimal-input.js
parent018b1d006f30f7022252c39849abaf8be6fffa45 (diff)
downloadtangerine-wallet-browser-3400ed0955b7f31ddb0be182736fc1e7ae20d4da.tar.gz
tangerine-wallet-browser-3400ed0955b7f31ddb0be182736fc1e7ae20d4da.tar.zst
tangerine-wallet-browser-3400ed0955b7f31ddb0be182736fc1e7ae20d4da.zip
Fix a couple things
Sorry apparently the gas fixes weren't in the last commit, but are in this one. As reported in previous commit, fixes a bug where initial estimate is not derived from the network. Also fixes a bug where clicking "reset" does not clear our custom validation warnings.
Diffstat (limited to 'ui/app/components/hex-as-decimal-input.js')
-rw-r--r--ui/app/components/hex-as-decimal-input.js29
1 files changed, 24 insertions, 5 deletions
diff --git a/ui/app/components/hex-as-decimal-input.js b/ui/app/components/hex-as-decimal-input.js
index e39805787..96a11b84f 100644
--- a/ui/app/components/hex-as-decimal-input.js
+++ b/ui/app/components/hex-as-decimal-input.js
@@ -56,12 +56,11 @@ HexAsDecimalInput.prototype.render = function () {
}, style),
value: parseInt(decimalValue),
+ onBlur: (event) => {
+ this.updateValidity(event)
+ },
onChange: (event) => {
- const target = event.target
- const valid = target.checkValidity()
- if (valid) {
- this.setState({ invalid: null })
- }
+ this.updateValidity(event)
const hexString = (event.target.value === '') ? '' : hexify(event.target.value)
onChange(hexString)
},
@@ -103,6 +102,26 @@ HexAsDecimalInput.prototype.render = function () {
)
}
+HexAsDecimalInput.prototype.setValid = function (message) {
+ this.setState({ invalid: null })
+}
+
+HexAsDecimalInput.prototype.updateValidity = function (event) {
+ const target = event.target
+ const value = this.props.value
+ const newValue = target.value
+
+ if (value === newValue) {
+ return
+ }
+
+ const valid = target.checkValidity()
+ console.log('change triggered checking validity and found ' + valid)
+ if (valid) {
+ this.setState({ invalid: null })
+ }
+}
+
HexAsDecimalInput.prototype.constructWarning = function () {
const { name, min, max } = this.props
let message = name ? name + ' ' : ''