Skip to content
This repository has been archived by the owner on Mar 4, 2019. It is now read-only.

Feat: Added Picker component #204

Merged
merged 1 commit into from
Feb 21, 2019
Merged

Feat: Added Picker component #204

merged 1 commit into from
Feb 21, 2019

Conversation

JosefDuda
Copy link
Contributor

Summary: Picker implementation for each platform. Will be used for example as nationality selector in passenger section of booking screen.

Related to:
kiwicom/margarita#73
kiwicom/margarita#121

Desktop:
desktop

iOS:
ios

Android:
android

@netlify
Copy link

netlify bot commented Jan 22, 2019

Deploy preview for kiwicom-universal-components ready!

Built with commit 4c3650d

https://deploy-preview-204--kiwicom-universal-components.netlify.com

@RobinCsl
Copy link
Collaborator

This is in the storybook preview. There might be a small issue. Could you look at it @JoseDuSV ?

screenshot 2019-01-23 at 10 21 00

@JosefDuda
Copy link
Contributor Author

This is in the storybook preview. There might be a small issue. Could you look at it @JoseDuSV ?

screenshot 2019-01-23 at 10 21 00

Thanks, it's fixed now.

@RobinCsl
Copy link
Collaborator

@JoseDuSV There is a conflict in src/index.js, could you fix it?

Also, I am wondering about using the native browser UI for the web version. Would it be hard to do something like on the kiwi.com page?

@JosefDuda
Copy link
Contributor Author

@RobinCsl Conflict solved.

And you are right, there is definitely room for improvement in web version. For now there is native select used in passenger form section even on kiwi (only button style is slightly different).

screenshot 2019-01-23 at 14 44 20

But we definitely don't need to strictly follow it and we can make the select items style nicer and closer to class selector on homepage.

screenshot 2019-01-23 at 14 44 45

Can we just merge this PR to make component available and I will create extra issue for web version improvements. Thanks

render() {
const { open, selectedValue, pickerValue } = this.state;
const { optionsData } = this.props;
const selectedOption = optionsData.find(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This logic, and the corresponding component is duplicated between ios and android. Could you extract it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whole duplicate native picker implementation extracted to separate component and duplicate function added to PickerHelpers.

>
{pickerOptions}
</RNPicker>
<Button onPress={this.handleOkPress} type="secondary" label="OK" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure about this label. I guess OK is pretty international. But we really need to be wary of this. What could we do about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Label extracted to props as in other cases.


import type { Props } from './PickerTypes';

const DEFAULT_OPTION = 'default-empty-option';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you explain what this achieves?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Short description added to const. Hope it will be clearer now.

@JosefDuda JosefDuda changed the title Feat: Added Picker component [WIP] Feat: Added Picker component Jan 24, 2019
@JosefDuda JosefDuda added the WIP label Jan 24, 2019
@RobinCsl
Copy link
Collaborator

Also, this is not strictly related to this PR, but we will need to find a way to properly pass prop types to the components in MDX files as Docz does not parse them if they are outside.
screenshot 2019-01-24 at 12 14 29

@JosefDuda
Copy link
Contributor Author

Also, this is not strictly related to this PR, but we will need to find a way to properly pass prop types to the components in MDX files as Docz does not parse them if they are outside.
screenshot 2019-01-24 at 12 14 29

@RobinCsl Definitely, I've already created issue for it #201

@JosefDuda JosefDuda force-pushed the feat/picker branch 2 times, most recently from f631736 to 2142dae Compare February 6, 2019 16:23
Summary: Picker implementation for each platform. Will be used for example as nationality selector in passenger section of booking screen.
@JosefDuda JosefDuda removed the WIP label Feb 19, 2019
@JosefDuda JosefDuda changed the title [WIP] Feat: Added Picker component Feat: Added Picker component Feb 19, 2019
@JosefDuda
Copy link
Contributor Author

iOS version now uses modal to show options. So the implementation is more flexible than in first iteration.

picker-ios

expect(getByText(testData[1].label)).toBeDefined();
});

it('renders', () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sometimes I wonder of the usefulness and value of these shallow snapshots. Maybe the previous test is enough to assert that your component at least rendered the right label.

@RobinCsl RobinCsl merged commit 4bbfed9 into master Feb 21, 2019
@RobinCsl RobinCsl deleted the feat/picker branch February 21, 2019 16:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants