Skip to content

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

Merged
merged 13 commits into from
Apr 8, 2021
Merged

Feat/segmentetControl new component #1238

merged 13 commits into from
Apr 8, 2021

Conversation

lidord-wix
Copy link
Contributor

Description

Segmented control component

Changelog

New component - SegmentedControl

@lidord-wix lidord-wix marked this pull request as ready for review March 30, 2021 11:41
@lidord-wix lidord-wix requested a review from ethanshar March 30, 2021 11:41
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.

The code looks great!
Wrote few comments..

<Segment
segmentOnLayout={this.onLayout}
index={index}
onPress={index => this.onSegmentPress(index)}
Copy link
Collaborator

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..

Copy link
Collaborator

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.

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.

@lidord-wix
See my recent comment regarding the animation issue

@lidord-wix lidord-wix requested a review from ethanshar April 5, 2021 08:17
<Segment
segmentOnLayout={this.onLayout}
index={index}
onPress={index => this.onSegmentPress(index)}
Copy link
Collaborator

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.

@lidord-wix lidord-wix requested a review from ethanshar April 7, 2021 12:42
@ethanshar ethanshar merged commit 9e9dad6 into master Apr 8, 2021
@lidord-wix lidord-wix deleted the feat/segmentedControl branch April 19, 2021 14:41
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