-
Notifications
You must be signed in to change notification settings - Fork 734
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
Conversation
demo/src/screens/componentScreens/SectionsWheelPickerScreen.tsx
Outdated
Show resolved
Hide resolved
Looks great! I wrote a few comments.. |
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.
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}> |
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.
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%'}}/> |
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.
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
src/incubator/WheelPicker/Item.tsx
Outdated
style={{ | ||
height: itemHeight | ||
height: itemHeight, | ||
minWidth: Spacings.s10 | ||
}} |
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.
Use StyleSheet for static styles.
And I suggest memoizing the style we pass here, It can save performance.
src/index.ts
Outdated
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'; |
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.
I don't think this one is part of the PR (:
Merging master will probably fix that
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.
There was a conflict here after merging master
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.
Looks great, I approved.
I wrote a small comment after the imports order
src/incubator/WheelPicker/Item.tsx
Outdated
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'; |
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.
keep module imports at the top, relative imports after
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