diff --git a/demo/src/index.js b/demo/src/index.js index ed47fc9fad..a90343bdc8 100644 --- a/demo/src/index.js +++ b/demo/src/index.js @@ -267,6 +267,9 @@ module.exports = { get Pinterest() { return require('./screens/realExamples/Pinterest').default; }, + get PieChartScreen() { + return require('./screens/componentScreens/PieChartScreen.tsx').default; + }, get ListActionsScreen() { return require('./screens/realExamples/ListActions/ListActionsScreen').default; }, diff --git a/demo/src/screens/MenuStructure.js b/demo/src/screens/MenuStructure.js index 3b2bfbe003..c755c44436 100644 --- a/demo/src/screens/MenuStructure.js +++ b/demo/src/screens/MenuStructure.js @@ -104,6 +104,12 @@ export const navigationData = { {title: 'SortableGridList', tags: 'sort grid list drag', screen: 'unicorn.components.SortableGridListScreen'} ] }, + Charts: { + title: 'Charts', + screens: [ + {title: 'PieChart', tags: 'pie chart data', screen: 'unicorn.components.PieChartScreen'} + ] + }, LayoutsAndTemplates: { title: 'Layouts & Templates', screens: [ diff --git a/demo/src/screens/componentScreens/PickerScreen.tsx b/demo/src/screens/componentScreens/PickerScreen.tsx index 4a2c20fa0d..fa7459bffa 100644 --- a/demo/src/screens/componentScreens/PickerScreen.tsx +++ b/demo/src/screens/componentScreens/PickerScreen.tsx @@ -83,6 +83,15 @@ const dialogOptions = [ {label: 'Option 8', value: 6} ]; +const statusOptions = [ + {label: 'Overview', value: 'overview'}, + {label: 'In Progress', value: 'inProgress'}, + {label: 'Completed', value: 'completed'}, + {label: 'Pending Review', value: 'pendingReview'}, + {label: 'Approved', value: 'approved'}, + {label: 'Rejected', value: 'rejected'} +]; + export default class PickerScreen extends Component { picker = React.createRef(); state = { @@ -96,6 +105,7 @@ export default class PickerScreen extends Component { dialogPickerValue: 'java', customModalValues: [], filter: undefined, + statOption: [], scheme: undefined, contact: 0 }; @@ -122,6 +132,15 @@ export default class PickerScreen extends Component { ); }; + onTopElementPress = (allOptionsSelected: boolean) => { + if (allOptionsSelected) { + this.setState({statOption: []}); + } else { + const allValues = statusOptions.map(option => option.value); + this.setState({statOption: allValues}); + } + }; + render() { return ( @@ -195,7 +214,32 @@ export default class PickerScreen extends Component { searchPlaceholder={'Search a language'} items={dialogOptions} /> - + + + Custom Top Element: + + this.setState({statOption: items})} + topBarProps={{title: 'Status'}} + mode={Picker.modes.MULTI} + items={statusOptions} + renderCustomTopElement={value => { + const allOptionsSelected = Array.isArray(value) && value.length === statusOptions.length; + return ( + +