Skip to content

Commit

Permalink
feat: add align-content: space-evenly support
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomura committed Sep 22, 2024
1 parent f8a3c73 commit 45c7e61
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .changeset/smart-ligers-deny.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@react-pdf/layout": minor
"@react-pdf/types": minor
---

feat: add align-content: space-evenly support
1 change: 1 addition & 0 deletions packages/layout/src/node/setAlign.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const ALIGN = {
baseline: Yoga.Align.Baseline,
'space-between': Yoga.Align.SpaceBetween,
'space-around': Yoga.Align.SpaceAround,
'space-evenly': Yoga.Align.SpaceEvenly,
};

/**
Expand Down
8 changes: 8 additions & 0 deletions packages/layout/tests/node/setAlignContent.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,12 @@ describe('node setAlignContent', () => {
expect(mock.mock.calls[0][0]).toBe(Yoga.Align.SpaceAround);
expect(result).toBe(node);
});

test('Should set space-evenly', () => {
const result = setAlignContent('space-evenly')(node);

expect(mock.mock.calls).toHaveLength(1);
expect(mock.mock.calls[0][0]).toBe(Yoga.Align.SpaceEvenly);
expect(result).toBe(node);
});
});
3 changes: 2 additions & 1 deletion packages/types/style.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export interface Style {
| 'center'
| 'stretch'
| 'space-between'
| 'space-around';
| 'space-around'
| 'space-evenly';
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline';
alignSelf?:
| 'auto'
Expand Down

0 comments on commit 45c7e61

Please sign in to comment.