Skip to content

Feat/SectionsWheelPicker new component #1260

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 11 commits into from
May 4, 2021

Conversation

lidord-wix
Copy link
Contributor

Description

Create a new SectionsWheelPicker component to present a set of wheelPickers
Jira 155

Changelog

Create a new SectionsWheelPicker component to present a set of wheelPickers

@ethanshar
Copy link
Collaborator

Looks great! I wrote a few comments..

@lidord-wix lidord-wix requested a review from ethanshar April 25, 2021 15:42
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.

Wrote some last few comments 👍

@@ -56,7 +54,7 @@ const SectionsWheelPicker = (props: SectionsWheelPickerProps) => {
const renderSections = () =>
_.map(sections, (section, index) => {
return (
<View height={1} width={section.style?.width || defaultWidth} key={index} testID={testID}>
<View height={1} width={section.style?.width} key={index} testID={testID}>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Passing the width here is redundant cause the width should come from the wheel picker content and the style is passed there

@@ -56,7 +54,7 @@ const SectionsWheelPicker = (props: SectionsWheelPickerProps) => {
const renderSections = () =>
_.map(sections, (section, index) => {
return (
<View height={1} width={section.style?.width || defaultWidth} key={index} testID={testID}>
<View height={1} width={section.style?.width} key={index} testID={testID}>
<WheelPicker testID={`${testID}.${index}`} {...wheelPickerProps} {...section} style={{width: '100%'}}/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, no reason to pass the width, the content of the wheel picker should determine its size.
Also, regardless, passing the style like that overrides the user style

Comment on lines 53 to 56
style={{
height: itemHeight
height: itemHeight,
minWidth: Spacings.s10
}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use StyleSheet for static styles.
And I suggest memoizing the style we pass here, It can save performance.

src/index.ts Outdated
Comment on lines 43 to 44
export {default as SegmentedControl, SegmentedControlProps} from './components/segmentedControl';
export {default as SegmentedControl, SegmentedControlProps, SegmentedControlItemProps} from './components/segmentedControl';
export {default as Switch, SwitchProps} from './components/switch';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this one is part of the PR (:
Merging master will probably fix that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There was a conflict here after merging master

@lidord-wix lidord-wix requested a review from ethanshar May 3, 2021 06:58
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.

Looks great, I approved.
I wrote a small comment after the imports order

Comment on lines 2 to 6
import Animated, {interpolateColors} from 'react-native-reanimated';
import Text from '../../components/text';
import TouchableOpacity from '../../components/touchableOpacity';
import {TextStyle} from 'react-native';
import {TextStyle, StyleSheet} from 'react-native';
import {Colors, Spacings} from '../../../src/style';
Copy link
Collaborator

Choose a reason for hiding this comment

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

keep module imports at the top, relative imports after

@lidord-wix lidord-wix merged commit ebb690c into master May 4, 2021
@lidord-wix lidord-wix deleted the feat/sectionsWheelPicker_new_component branch May 31, 2021 08:50
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