From e5f4ea4a1ccd37350c8ef64a2337367d064da7a7 Mon Sep 17 00:00:00 2001 From: Josh Howenstine Date: Wed, 15 Nov 2023 06:55:47 -0800 Subject: [PATCH 1/4] fix: remove applySmooth in button to fix display issue when used in Row or Column. Add gaurds around withThemeStyles for firstEnable --- .../src/components/Button/Button.js | 2 +- .../__snapshots__/Keyboard.test.js.snap | 4 +-- .../src/mixins/withThemeStyles/index.js | 29 ++++++++++++++----- 3 files changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/@lightningjs/ui-components/src/components/Button/Button.js b/packages/@lightningjs/ui-components/src/components/Button/Button.js index 7e4c3fcf1..17539bf98 100644 --- a/packages/@lightningjs/ui-components/src/components/Button/Button.js +++ b/packages/@lightningjs/ui-components/src/components/Button/Button.js @@ -233,7 +233,7 @@ export default class Button extends Surface { } if (Object.keys(contentDimensionsPatch).length > 0) { - this.applySmooth(this._Content, contentDimensionsPatch); + this._Content.patch(contentDimensionsPatch); } } diff --git a/packages/@lightningjs/ui-components/src/components/Keyboard/__snapshots__/Keyboard.test.js.snap b/packages/@lightningjs/ui-components/src/components/Keyboard/__snapshots__/Keyboard.test.js.snap index 7685de0dc..fa28b1198 100644 --- a/packages/@lightningjs/ui-components/src/components/Keyboard/__snapshots__/Keyboard.test.js.snap +++ b/packages/@lightningjs/ui-components/src/components/Keyboard/__snapshots__/Keyboard.test.js.snap @@ -8810,7 +8810,7 @@ exports[`Keyboard renders 1`] = ` "visible": true, "w": 0, "x": 35, - "y": [Function], + "y": 45, "zIndex": 2, }, }, @@ -11871,7 +11871,7 @@ exports[`KeyboardInput renders 1`] = ` "visible": true, "w": 0, "x": 30, - "y": [Function], + "y": 0, "zIndex": 2, }, "Eyebrow": { diff --git a/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js b/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js index f2de58ca4..e245848db 100644 --- a/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js +++ b/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js @@ -50,6 +50,11 @@ export default function withThemeStyles(Base, mixinStyle = {}) { this._updatePropDefaults(); this.queueThemeUpdate(); }); + + this._whenEnabled = new Promise(resolve => { + this._whenEnabledResolver = resolve; + }); + this._withThemeStylesSetupComplete = true; } @@ -70,6 +75,14 @@ export default function withThemeStyles(Base, mixinStyle = {}) { } } + _firstEnable() { + this._readyForUpdates = true; + this._whenEnabledResolver(); + updateManager.deleteRequestUpdate(this); + this.queueThemeUpdate(); + super._firstEnable && super._firstEnable(); + } + _updatePropDefaults() { // Add support for properties passed through the theme const componentConfigProps = this._styleManager.props || {}; @@ -168,13 +181,15 @@ export default function withThemeStyles(Base, mixinStyle = {}) { * @returns {void} */ _updateThemeComponent() { - if (!this.style) return; - if (!this._isAttached()) return; - this._checkDimensionUpdates(); - this.queueRequestUpdate - ? this.queueRequestUpdate() - : this._update && this._update(); - this._updateItemLayout && this._updateItemLayout(); + if (this._readyForUpdates) { + if (!this.style) return; + if (!this._isAttached()) return; + this._checkDimensionUpdates(); + this.queueRequestUpdate + ? this.queueRequestUpdate() + : this._update && this._update(); + this._updateItemLayout && this._updateItemLayout(); + } } /** From 7ca6841beb5cf780993b5ef70fa3ac5238a2d38a Mon Sep 17 00:00:00 2001 From: "David Richards, Jr" Date: Thu, 16 Nov 2023 10:45:07 -0500 Subject: [PATCH 2/4] Trigger Concourse From fa012056d98fafb40bf41ef754a34a5eb9b51d94 Mon Sep 17 00:00:00 2001 From: Josh Howenstine Date: Fri, 17 Nov 2023 08:08:58 -0800 Subject: [PATCH 3/4] fix: revert withThemeStyles change --- .../src/mixins/withThemeStyles/index.js | 31 +++++-------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js b/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js index e245848db..399f003ff 100644 --- a/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js +++ b/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js @@ -50,11 +50,6 @@ export default function withThemeStyles(Base, mixinStyle = {}) { this._updatePropDefaults(); this.queueThemeUpdate(); }); - - this._whenEnabled = new Promise(resolve => { - this._whenEnabledResolver = resolve; - }); - this._withThemeStylesSetupComplete = true; } @@ -75,14 +70,6 @@ export default function withThemeStyles(Base, mixinStyle = {}) { } } - _firstEnable() { - this._readyForUpdates = true; - this._whenEnabledResolver(); - updateManager.deleteRequestUpdate(this); - this.queueThemeUpdate(); - super._firstEnable && super._firstEnable(); - } - _updatePropDefaults() { // Add support for properties passed through the theme const componentConfigProps = this._styleManager.props || {}; @@ -181,15 +168,13 @@ export default function withThemeStyles(Base, mixinStyle = {}) { * @returns {void} */ _updateThemeComponent() { - if (this._readyForUpdates) { - if (!this.style) return; - if (!this._isAttached()) return; - this._checkDimensionUpdates(); - this.queueRequestUpdate - ? this.queueRequestUpdate() - : this._update && this._update(); - this._updateItemLayout && this._updateItemLayout(); - } + if (!this.style) return; + if (!this._isAttached()) return; + this._checkDimensionUpdates(); + this.queueRequestUpdate + ? this.queueRequestUpdate() + : this._update && this._update(); + this._updateItemLayout && this._updateItemLayout(); } /** @@ -367,4 +352,4 @@ export default function withThemeStyles(Base, mixinStyle = {}) { this._styleManager.update(); } }; -} +} \ No newline at end of file From a3b91a047db47c97bbe661ce828a8f74d93ddc90 Mon Sep 17 00:00:00 2001 From: Josh Howenstine Date: Fri, 17 Nov 2023 08:10:43 -0800 Subject: [PATCH 4/4] fix: remove space at end of file --- .../ui-components/src/mixins/withThemeStyles/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js b/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js index 399f003ff..f2de58ca4 100644 --- a/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js +++ b/packages/@lightningjs/ui-components/src/mixins/withThemeStyles/index.js @@ -352,4 +352,4 @@ export default function withThemeStyles(Base, mixinStyle = {}) { this._styleManager.update(); } }; -} \ No newline at end of file +}