fix: undefined and null wrap prop values are rendered as undefined instead of true by default
Similar to #3149 and #3142, this PR fixes a bug introduced in this change. When a wrap value of undefined or null is passed to <View> components, the latest versions of react-pdf will treat it as false instead of true (which should be the default value).
Also adds tests for this function.
⚠️ No Changeset found
Latest commit: 7324cf248d414c4d4781947352db63044ea8f1c2
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Is it correct that undefined was already returning true? I'm not sure about null though. That's a falsy value. Makes more sense to me to false for null than true
Is it correct that
undefinedwas already returning true?
The current behaviour is:
<View />is treated astrue<View wrap={undefined} />is treated asfalse<View wrap={null} />is treated asfalse<View wrap={false} />is treated asfalse<View wrap={true} />is treated asfalse
I think 1, 4 and 5 make sense. But 2 and 3 are unexpected to me.
I'm not sure about
nullthough. That's a falsy value. Makes more sense to me to false for null than true
I see where you're coming from however given that "no value" (case 1) and undefined (case 2) will evaluate to true I think having null evaluate to true is a more developer-friendly/consistent experience.
Let me know if you feel strongly about it and I'll make the PR change accordingly. Thanks @diegomura!