Skip to content

Commit

Permalink
fix: remove applySmooth in button to fix display issue when used in R…
Browse files Browse the repository at this point in the history
…ow or Column. Add gaurds around withThemeStyles for firstEnable
  • Loading branch information
joshhowenstine authored and ImCoolNowRight committed Nov 15, 2023
1 parent 1e93576 commit 04d5421
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8810,7 +8810,7 @@ exports[`Keyboard renders 1`] = `
"visible": true,
"w": 0,
"x": 35,
"y": [Function],
"y": 45,
"zIndex": 2,
},
},
Expand Down Expand Up @@ -11871,7 +11871,7 @@ exports[`KeyboardInput renders 1`] = `
"visible": true,
"w": 0,
"x": 30,
"y": [Function],
"y": 0,
"zIndex": 2,
},
"Eyebrow": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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 || {};
Expand Down Expand Up @@ -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();
}
}

/**
Expand Down

0 comments on commit 04d5421

Please sign in to comment.