-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"onChange" action doesn't informative #70
Comments
Gidday @epotockiy - thanks for your issue :) This feature is actually not quite as trivial as it may seem on the surface. The complexity comes down to the concept of 'order'. In other words, determining which is the 0th (and subsequent) Order by... order.<Accordion>
<AccordionItem>Zero</AccordionItem>
<AccordionItem>One</AccordionItem>
<AccordionItem>Two</AccordionItem>
</Accordion> Easy, right? The 0th is the 0th, and the 2nd is the 2nd. In this very simple case, we could use But what if... Order by depth<Accordion>
<span>
<span>
<AccordionItem>Foo</AccordionItem>
</span>
</span>
<AccordionItem>Bar</AccordionItem>
</Accordion> So, which is the 0th AccordionItem here? You might think that the obvious answer is That's just a minor detail though. Whichever way we went, I don't know how we would actually implement this anyway. I'm not sure whether you can actually use There's one more domain to cater for too, perhaps the most complex one: Order by timeclass App extends Component {
state = {
loaded: false,
}
componentDidMount() {
setTimeout(
() => this.setState({ loaded: true }),
1000
);
}
render() {
return (
<Accordion>
{loaded && (
<AccordionItem>Foo</AccordionItem>
)
<AccordionItem>Bar</AccordionItem>
</Accordion>
)
}
} So which is the 0th So where does that leave us?So, yes - I agree that the Eg: /* Copy and paste warning! The following feature (`uuid` prop) is not yet implemented! */
const items = [
{ uuid: 'foo', title: 'Foo!' },
{ uuid: 'bar', title: 'Bar!' },
];
return (
<Accordion>
{items.map(item => (
<AccordionItem uuid={item.uuid}>{item.title}</AccordionItem>
)}
</Accordion>
); Then, Would this kind of solution suit your needs? |
Yes it is. It would be perfect if you improvement implemented in the nearest future. |
Thanks for your feedback @epotockiy - we have this on our roadmap 😄 |
@epotockiy feel free to contribute with a PR if you want :) |
This will go in |
onChange
function get only one parameteruuid
which doesn't informative for outside components, could you replace it by an accordion item index or add this index as the second parameter of theonChange
functionThe text was updated successfully, but these errors were encountered: