react-ui icon indicating copy to clipboard operation
react-ui copied to clipboard

Layout context not working for bool props

Open mbohal opened this issue 1 year ago • 0 comments

Usecase:

Im trying to get an InputGroup with one child element disabled and one not:

<InputGroup>
  <TextField
    label="First name"
    disabled
  />
  <TextField
    label="Last name"
  />
</InputGroup>

Problem:

In the above example:

Current behaviour: none of the TextFields is disabled Expected behaviour: The First name TextField is disabled

Likely cause is https://github.com/react-ui-org/react-ui/blob/d532592001380c4c88a0f92d637e1b6bfbead5ce/src/components/_helpers/resolveContextOrProp.js#L2 where the contextProp is checked for being null / undefined but not against being false.

Solution:

We need to figure out how to take into account the default prop value in https://github.com/react-ui-org/react-ui/blob/d532592001380c4c88a0f92d637e1b6bfbead5ce/src/components/_helpers/resolveContextOrProp.js#L2. Assuming the default is null / undefined does not work for bool typed props.

mbohal avatar Sep 13 '24 13:09 mbohal