-
-
Notifications
You must be signed in to change notification settings - Fork 53.5k
Description
Reproduction link
Steps to reproduce
Ant version is actually 4.20.0-alpha.1 Which I know isn't the latest stable version but this is still a bug. Not allowed to use CodeSandBox on enterprise network.
const [foo, setFoo] = useState("AND")
<Segmented
value={foo}
options={["AND", "OR"]}
onChange={(e) => setFoo(e.target.value)}
/>
<Segmented
value={foo}
options={["AND", "OR"]}
onChange={(e) => setFoo(e.target.value)}
/>
What is expected?
The highlighted option should not be dependent on a "click" event on the Segmented component but rather should be dependent on the value passed into the component. I want multiple Segmented to be listening to the same state and the highlighted option should change on all Segmented components when state value changes, not only when the component is clicked.
What is actually happening?
Shared state value will be "OR" but one Segmented component will have "AND" highlighted but the other component that was clicked will have "OR" highlighted.
Environment | Info |
---|---|
antd | 4.19.5 |
React | 18.0.0 |
System | Windows 10 |
Browser | Chrome Version 100.0.4896.75 (Official Build) (64-bit) |
This functionality works as expected with the Switch component.