Skip to content

Commit

Permalink
fix: resolve styles on dynamic elements (#2629)
Browse files Browse the repository at this point in the history
* fix: resolve styles on dynamic elements

* chore: add changeset
  • Loading branch information
diegomura authored Feb 10, 2024
1 parent 021c354 commit 087ee22
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/seven-bottles-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-pdf/layout": patch
---

fix: resolve styles on dynamic elements
4 changes: 3 additions & 1 deletion packages/layout/src/steps/resolvePagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import shouldNodeBreak from '../node/shouldBreak';
import resolveTextLayout from './resolveTextLayout';
import resolveInheritance from './resolveInheritance';
import { resolvePageDimensions } from './resolveDimensions';
import { resolvePageStyles } from './resolveStyles';

const isText = (node) => node.type === P.Text;

Expand All @@ -33,8 +34,9 @@ const isDynamic = (node) => !isNil(node.props?.render);

const relayoutPage = compose(
resolveTextLayout,
resolveInheritance,
resolvePageDimensions,
resolveInheritance,
resolvePageStyles,
);

const warnUnavailableSpace = (node) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/src/steps/resolveStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const resolveNodeStyles = (container) => (node) => {
* @param {Object} page document page
* @returns {Object} document page with resolved styles
*/
const resolvePageStyles = (page) => {
export const resolvePageStyles = (page) => {
const dpi = page.props?.dpi || 72;
const width = page.box?.width || page.style.width;
const height = page.box?.height || page.style.height;
Expand Down

0 comments on commit 087ee22

Please sign in to comment.