`minWidth` and `maxWidth` accept percentages the docs say are unsupported
minWidth and maxWidth are typed as number | string in Styles (src/styles.ts), and styles.ts maps a string to setMinWidthPercent / setMaxWidthPercent. The readme and the doc comments say Type: number and "Percentages aren't supported yet; see https://github.com/facebook/yoga/issues/872". So TypeScript accepts a value the docs say does not work, and the value silently resolves against the wrong ancestor.
<Box width={10}>
<Box minWidth="50%"><Text>A</Text></Box>
<Text>B</Text>
</Box>Output on master: "A B" (the inner box is 40 columns, half of the 80-column root, not half of the 10-column parent). maxWidth="50%" has the same problem. Both are pinned by the two test.failing cases in test/width-height.tsx. The cause is upstream: a raw yoga-layout 3.2.1 tree with root 80, parent 10 and a child with setMinWidthPercent(50) computes the child at 40. That is react/yoga#872, still open, with the fix PR react/yoga#1015 unmerged since 2020.
Expected: the type matches the docs. Narrowing minWidth and maxWidth to number and dropping the two percent branches in styles.ts would turn the silent misrender into a type error until Yoga fixes it, with the test.failing cases left in place as the tripwire. minHeight and maxHeight percentages are unaffected and keep number | string.
Reproduced on master (d661543).
Source: vadimdemedes/ink