diegomura / diegomura/react-pdf

Unable to set flexShrink to 0

Open Beginner friendly
#3,562 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
5h 6m
Merged PRs (30d)
52

Description

**Describe the bug**
Due to implementation of setFlexShrink when 0 is passed it defaults back to 1

https://github.com/diegomura/react-pdf/blob/ca8a425bdfb9a8ab9b26e724cd747431372fe147/packages/layout/src/node/setFlexShrink.ts

**To Reproduce**
Create element with flexShrink set to 0

[REPL repro](https://react-pdf.org/playground?code=3187b0760ce02e004d09e01b02984605e18194a4e5600b6592803a6002764043299002806f00a06180076a0736402e1859b369c00988809660bbf006c001958c00be0068db32501280373366a122c00c2e0a3549c8286184d8017188455305a3003e018aa9400ae14c0d800f001ab8b2003b9c2e0a3a23230011880508a5bf001100233b00079c082238888c3c62353000359a5ab86154013a465c9c8029154c11389701142f235c9a802db505172480108814140800ff002b1c92929ba31d8393b20ba0403d28445ba686aebeb83436010524b975bd26bba79b379f807d085864420c5c7c597957050807c6011099104974950446d18000cc50d94225cc0e55e92cdc81000ab21b250159a40032496400c60e2760407c24b4a90a8ec1a141e87d4d12876589c7a376ef0391cf40633800454c88ab98c01e54d8dceee80f208604f7f104f61f68b2162095fbfd01c0d07826069128f9906d3876385c8de22d9698ec6e31804a2492c914aa4d39074da2329accd64da394aee5298e7cd820ac050337940062e26cb208a985bbdd65f2979bc22513c1aa7e154d50241f95d7eb1086e37c22316d21349a193475bd976c25511de4ca5eb5dee8653259db366e276fec3a0779a75808840c01ba290282e025336b8c51b10200056e32060d8ba65c06f3ea22157a3302d1c4e00cd7d3ea85227078cb45d09022630f98c096371de843040847b66f8fc7fa74285c2298a9b0feefa7edb23e66058142fe7f83ea633eafb814bb7e705fe9fa86e1901c8b46b1888604613b141486c1778ec07b20704ec339ce619be3a1e800128d0c0140cbbf291abac0a58f418ec023140000)

**Expected behavior**
Element does not shrink. Same as when 0.001 is passed

**Screenshots**
Image

Contributor guide

Open the contributing guide

Research direction

Start with packages/layout/src/node/setFlexShrink.ts, which the issue identifies as the implementation involved. Reproduce the behavior with flexShrink set to 0 using the linked playground, then verify that the element does not shrink as expected and that the existing nonzero behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.