Skip to content

Feat/expandable list item new component #943

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

Merged
merged 14 commits into from
Sep 25, 2020

Conversation

lidord-wix
Copy link
Contributor

Description

Add generic expandableSection component that render headerSection element and children as a content of the component.

Copy link
Collaborator

@ethanshar ethanshar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments on this PR
First, try avoid having an inline style. Always move styles into StyleSheet when possible.
Passing inline style can affect performance.

Second, Regarding the structure of the component. I left some comments.
Let me know if something is not clear..

One last thing.
Notice that when you collapse the component, there's a brief moment where you can still see the children overflow the boundary. Try looking into the overflow style prop in order to fix that..

const {expanded, sectionHeader, children} = props;

function onValueChange() {
LayoutAnimation.configureNext({...LayoutAnimation.Presets.easeInEaseOut, duration: 200});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't trigger animation or update things during a render.
Render can be triggered for many reasons and that means you'll trigger an animation even when you don't intend to.
For that we use hooks like useEffect. (or lifecycle methods in case you use classes)

*/
children?: React.ReactNode;
/**
* expandableSection icon color
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot changing the prop description (:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙊

@ethanshar ethanshar merged commit 136ba44 into master Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants