(node: LayoutNode, style: Styles)
| 628 | } |
| 629 | |
| 630 | const applyDimensionStyles = (node: LayoutNode, style: Styles): void => { |
| 631 | if ('width' in style) { |
| 632 | if (typeof style.width === 'number') { |
| 633 | node.setWidth(style.width) |
| 634 | } else if (typeof style.width === 'string') { |
| 635 | node.setWidthPercent(Number.parseInt(style.width, 10)) |
| 636 | } else { |
| 637 | node.setWidthAuto() |
| 638 | } |
| 639 | } |
| 640 | |
| 641 | if ('height' in style) { |
| 642 | if (typeof style.height === 'number') { |
| 643 | node.setHeight(style.height) |
| 644 | } else if (typeof style.height === 'string') { |
| 645 | node.setHeightPercent(Number.parseInt(style.height, 10)) |
| 646 | } else { |
| 647 | node.setHeightAuto() |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | if ('minWidth' in style) { |
| 652 | if (typeof style.minWidth === 'string') { |
| 653 | node.setMinWidthPercent(Number.parseInt(style.minWidth, 10)) |
| 654 | } else { |
| 655 | node.setMinWidth(style.minWidth ?? 0) |
| 656 | } |
| 657 | } |
| 658 | |
| 659 | if ('minHeight' in style) { |
| 660 | if (typeof style.minHeight === 'string') { |
| 661 | node.setMinHeightPercent(Number.parseInt(style.minHeight, 10)) |
| 662 | } else { |
| 663 | node.setMinHeight(style.minHeight ?? 0) |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | if ('maxWidth' in style) { |
| 668 | if (typeof style.maxWidth === 'string') { |
| 669 | node.setMaxWidthPercent(Number.parseInt(style.maxWidth, 10)) |
| 670 | } else { |
| 671 | node.setMaxWidth(style.maxWidth ?? 0) |
| 672 | } |
| 673 | } |
| 674 | |
| 675 | if ('maxHeight' in style) { |
| 676 | if (typeof style.maxHeight === 'string') { |
| 677 | node.setMaxHeightPercent(Number.parseInt(style.maxHeight, 10)) |
| 678 | } else { |
| 679 | node.setMaxHeight(style.maxHeight ?? 0) |
| 680 | } |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | const applyDisplayStyles = (node: LayoutNode, style: Styles): void => { |
| 685 | if ('display' in style) { |
no test coverage detected