Unable to set flexShrink to 0

Open Beginner friendly
#3,562 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

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.

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

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

Screenshots
Image

Dominant language
TypeScript
Stars
16.8k
Forks
1.3k
Avg merge
2h 35m
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from diegomura/react-pdf

All issues in diegomura/react-pdf

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.