-
Notifications
You must be signed in to change notification settings - Fork 734
Feat/segmentetControl new component #1238
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks great!
Wrote few comments..
<Segment | ||
segmentOnLayout={this.onLayout} | ||
index={index} | ||
onPress={index => this.onSegmentPress(index)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid inline callbacks
This is a great practice in performance.
Add a console.log to the segment
component render.
Notice that when changing the active segment, all of the segments will print the log.
When only 2 should print it (the one that become unselected and new selected)
This is caused because you're passing an incline callback..
If are not familiar with why, let me know, I'd be happy to go over it together and explain in details..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm adding a console.log to Segment
component it still prints all of the segments when switching the active segment.
I suggest investigating what's causing the extra renders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lidord-wix
See my recent comment regarding the animation issue
<Segment | ||
segmentOnLayout={this.onLayout} | ||
index={index} | ||
onPress={index => this.onSegmentPress(index)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm adding a console.log to Segment
component it still prints all of the segments when switching the active segment.
I suggest investigating what's causing the extra renders.
Description
Segmented control component
Changelog
New component - SegmentedControl