Skip to content

Commit

Permalink
feat(docs): select showcases add
Browse files Browse the repository at this point in the history
  • Loading branch information
32penkin committed Oct 16, 2019
1 parent 14b7fa4 commit 0f44dcd
Show file tree
Hide file tree
Showing 7 changed files with 305 additions and 65 deletions.
12 changes: 11 additions & 1 deletion src/framework/ui/select/select.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ interface State {
}

/**
* Styled `Select` component.
* Styled `Select` component. By default, the MultiSelect compares the items by reference.
* To specify a field from the data object which will be used for the comparison,
* implement the `keyExtractor` property.
*
* @extends React.Component
*
Expand Down Expand Up @@ -141,6 +143,14 @@ interface State {
*
* @overview-example SelectWithGroups
*
* @overview-example SelectPreselectedInline
*
* @overview-example SelectPreselectedReference
*
* @overview-example SelectMultiPreselectedInline
*
* @overview-example SelectMultiPreselectedReference
*
* @example SelectCustomIcon
*
* @example SelectInlineStyling
Expand Down
147 changes: 83 additions & 64 deletions src/playground/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/playground/src/ui/screen/showcases/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ export { SelectWithGroupsShowcase } from './selectWithGroups.component';
export { SelectCustomIconShowcase } from './selectCustomIcon.component';
export { SelectStatusShowcase } from './selectStatus.component';
export { SelectInlineStylingShowcase } from './selectInlineStyling.component';
export { SelectPreselectedInlineShowcase } from './selectPreselectedInline.component';
export { SelectPreselectedReferenceShowcase } from './selectPreselectedReference.component';
export { SelectMultiPreselectedInlineShowcase } from './selectMultiPreselectedInline.component';
export { SelectMultiPreselectedReferenceShowcase } from './selectMultiPreselectedReference.component';
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* IMPORTANT: Do not forget to set keyExtractor property in such case!
*/

import React from 'react';
import { StyleSheet } from 'react-native';
import {
Layout,
Select,
} from 'react-native-ui-kitten';

export class SelectMultiPreselectedInlineShowcase extends React.Component {

data = [
{ text: 'Option 1' },
{ text: 'Option 2' },
{ text: 'Option 3' },
];

state = {
selectedOption: [
{ text: 'Option 2' },
{ text: 'Option 3' },
],
};

onSelect = (selectedOption) => {
this.setState({ selectedOption });
};

extractKey = (item) => {
return item.text;
};

render() {
return (
<Layout style={styles.container}>
<Select
data={this.data}
multiSelect={true}
selectedOption={this.state.selectedOption}
keyExtractor={this.extractKey}
onSelect={this.onSelect}
/>
</Layout>
);
}
}

const styles = StyleSheet.create({
container: {
height: 230,
padding: 16,
},
});

Loading

0 comments on commit 0f44dcd

Please sign in to comment.