Skip to content

bug: React IonRange is disabled even if disabled === undefined #19563

Description

@bohdanbirdie

Bug Report

Ionic version:
"@ionic/core": "^4.10.0",
"@ionic/react": "^4.10.0-rc.3",

Current behavior:

Having IonRange component and it's prop disabled to which I pass variable that can be type boolean | undefined,
-> when the variable is equal to false IonRange is enabled
-> when the variable is equal to true IonRange is disabled
-> when the variable is equal to undefined IonRange is enabled

Expected behavior:

Having IonRange component and it's prop disabled to which I pass variable that can be type boolean | undefined,
-> when the variable is equal to false IonRange have to be enabled
-> when the variable is equal to true IonRange have to be disabled
-> when the variable is equal to undefined IonRange have to be disabled because undefined is a falsy value

Steps to reproduce:

Related code:

<div className={rangeModifier(urgencyIndex)}>
      <IonRange
        disabled={readOnly}
        max={urgency && urgency.size}
        min={1}
        mode='ios'
        onIonChange={onChange}
        snaps
        step={1}
        value={urgencyIndex}
      />
    </div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions