File tree Expand file tree Collapse file tree 2 files changed +22
-15
lines changed
packages/plugin-flexbox/src Expand file tree Collapse file tree 2 files changed +22
-15
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @plexinc/react-lightning-plugin-flexbox " : patch
3+ ---
4+
5+ Fixed maxWidth being applied incorrectly on unmeasured elements
Original file line number Diff line number Diff line change @@ -240,23 +240,25 @@ export function plugin(yogaOptions?: YogaOptions): Plugin<LightningElement> {
240240 // be the computed width
241241 let computedWidth = flexInstance . yogaNode . getComputedWidth ( ) ;
242242
243- if (
244- Number . isNaN ( computedWidth ) &&
245- maxWidth . unit === Yoga . instance . UNIT_PERCENT
246- ) {
247- // Try to get the parent width and calculating manually
248- const parentWidth = flexInstance . yogaNode
249- . getParent ( )
250- ?. getComputedWidth ( ) ;
251-
252- if ( parentWidth ) {
253- computedWidth = parentWidth * ( maxWidth . value / 100 ) ;
243+ if ( computedWidth > 0 ) {
244+ if (
245+ Number . isNaN ( computedWidth ) &&
246+ maxWidth . unit === Yoga . instance . UNIT_PERCENT
247+ ) {
248+ // Try to get the parent width and calculating manually
249+ const parentWidth = flexInstance . yogaNode
250+ . getParent ( )
251+ ?. getComputedWidth ( ) ;
252+
253+ if ( parentWidth ) {
254+ computedWidth = parentWidth * ( maxWidth . value / 100 ) ;
255+ }
254256 }
255- }
256257
257- if ( event . dimensions . width > computedWidth ) {
258- node . contain = 'width' ;
259- node . width = computedWidth ;
258+ if ( event . dimensions . width > computedWidth ) {
259+ node . contain = 'width' ;
260+ node . width = computedWidth ;
261+ }
260262 }
261263 }
262264
You can’t perform that action at this time.
0 commit comments