Skip to content
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

Infra/incubator action sheet #3472

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
17 changes: 15 additions & 2 deletions demo/src/screens/MenuStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ export const navigationData = {
title: 'Overlays',
screens: [
{title: 'Action Sheet', tags: 'action sheet cross-platform', screen: 'unicorn.components.ActionSheetScreen'},
{
title: 'Action Sheet (Incubator)',
tags: 'action sheet',
screen: 'unicorn.components.IncubatorActionSheetScreen'
},
{title: 'Dialog', tags: 'dialog modal popup alert', screen: 'unicorn.components.DialogScreen'},
{title: 'Feature Highlight', tags: 'feature overlay', screen: 'unicorn.components.FeatureHighlightScreen'},
{title: 'Floating Button', tags: 'floating button', screen: 'unicorn.components.FloatingButtonScreen'},
Expand All @@ -99,7 +104,11 @@ export const navigationData = {
{title: 'Conversation List', tags: 'list conversation', screen: 'unicorn.lists.ConversationListScreen'},
{title: 'Drawer', tags: 'drawer', screen: 'unicorn.components.DrawerScreen'},
{title: 'SortableList', tags: 'sortable list drag', screen: 'unicorn.components.SortableListScreen'},
{title: 'HorizontalSortableList', tags: 'sortable horizontal list drag', screen: 'unicorn.components.HorizontalSortableListScreen'},
{
title: 'HorizontalSortableList',
tags: 'sortable horizontal list drag',
screen: 'unicorn.components.HorizontalSortableListScreen'
},
{title: 'GridList', tags: 'grid list', screen: 'unicorn.components.GridListScreen'},
{title: 'SortableGridList', tags: 'sort grid list drag', screen: 'unicorn.components.SortableGridListScreen'}
]
Expand All @@ -114,7 +123,11 @@ export const navigationData = {
{title: 'Modal', tags: 'modal topbar screen', screen: 'unicorn.screens.ModalScreen'},
{title: 'StateScreen', tags: 'empty state screen', screen: 'unicorn.screens.EmptyStateScreen'},
{title: 'TabController', tags: 'tabbar controller native', screen: 'unicorn.components.TabControllerScreen'},
{title: 'TabControllerWithStickyHeader', tags: 'tabbar controller native sticky header', screen: 'unicorn.components.TabControllerWithStickyHeaderScreen'},
{
title: 'TabControllerWithStickyHeader',
tags: 'tabbar controller native sticky header',
screen: 'unicorn.components.TabControllerWithStickyHeaderScreen'
},
{title: 'Timeline', tags: 'timeline', screen: 'unicorn.components.TimelineScreen'},
{
title: 'withScrollEnabler',
Expand Down
127 changes: 127 additions & 0 deletions demo/src/screens/incubatorScreens/ActionSheetItems.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
import React from 'react';
import {Alert, StyleSheet} from 'react-native';
import {Assets, BorderRadiuses, Colors, Image, ImageProps, Spacings, View} from 'react-native-ui-lib';

export enum TEXT_LENGTH {
NO_TEXT = 'No text',
SHORT = 'Short',
LONG = 'Long'
}

export enum CUSTOM_TITLE_COMPONENT {
NONE = 'None',
AVATAR = 'Avatar',
ICON = 'Icon',
THUMBNAIL = 'Thumbnail'
}

export enum OPTIONS_TYPE {
NONE = 'None',
REGULAR = 'Regular',
WITH_ICONS = 'With icons',
SECTION_HEADERS = 'Section headers',
GRID_VIEW = 'Grid view'
}

export type State = {
titleLength: TEXT_LENGTH;
titleIsProminent: boolean;
titleIsClickable: boolean;
subtitleLength: TEXT_LENGTH;
showFooter: boolean;
optionsType: OPTIONS_TYPE;
visible: boolean;
};

export const ICONS = [
Assets.icons.demo.settings,
Assets.icons.demo.refresh,
Assets.icons.check,
Assets.icons.x,
Assets.icons.plusSmall,
Assets.icons.demo.camera
];

const GRID_ITEM_CIRCLE_SIZE = 52;

const pickOption = (option: string) => {
Alert.alert(`picked: ${option}`);
};

const renderCustomItem = (imageProps: ImageProps) => {
return (
<View center style={styles.gridItemCircle}>
<Image {...imageProps}/>
</View>
);
};

export const listItems = [
{title: 'Open Settings', onPress: () => pickOption('Open Settings')},
{title: 'View Notifications', onPress: () => pickOption('View Notifications')},
{title: 'Update Profile', onPress: () => pickOption('Update Profile')},
{title: 'Log Out', onPress: () => pickOption('Log Out')},
{title: 'Share Post', onPress: () => pickOption('Share Post')},
{title: 'Send Message', onPress: () => pickOption('Send Message')},
{title: 'Take Photo', onPress: () => pickOption('Take Photo')},
{title: 'Record Video', onPress: () => pickOption('Record Video')},
{title: 'Add to Favorites', onPress: () => pickOption('Add to Favorites')},
{title: 'Search', onPress: () => pickOption('Search')},
{title: 'Refresh Feed', onPress: () => pickOption('Refresh Feed')},
{title: 'Edit Post', onPress: () => pickOption('Edit Post')},
{title: 'Report Issue', onPress: () => pickOption('Report Issue')},
{title: 'Contact Support', onPress: () => pickOption('Contact Support')},
{title: 'View Profile', onPress: () => pickOption('View Profile')},
{title: 'Cancel', onPress: () => pickOption('Cancel')}
];

export const gridItems = [
{
title: 'Open Settings',
renderCustomItem: () => renderCustomItem({source: Assets.icons.demo.settings}),
onPress: () => pickOption('Open Settings')
},
{
title: 'View Notifications',
renderCustomItem: () => renderCustomItem({source: Assets.icons.demo.refresh}),
onPress: () => pickOption('View Notifications')
},
{
title: 'Update Profile',
renderCustomItem: () => renderCustomItem({source: Assets.icons.check}),
onPress: () => pickOption('Update Profile'),
avoidDismiss: true
},
{
title: 'Log Out',
renderCustomItem: () => renderCustomItem({source: Assets.icons.x}),
onPress: () => pickOption('Log Out')
},
{
title: 'Share Post',
renderCustomItem: () => renderCustomItem({source: Assets.icons.plusSmall}),
onPress: () => pickOption('Share Post')
},
{
title: 'Take Photo',
renderCustomItem: () => renderCustomItem({source: Assets.icons.demo.camera}),
onPress: () => pickOption('Take Photo')
},
{
title: 'Record Video',
renderCustomItem: () => renderCustomItem({source: Assets.icons.demo.camera}),
onPress: () => pickOption('Record Video')
}
];

const styles = StyleSheet.create({
gridItemCircle: {
width: GRID_ITEM_CIRCLE_SIZE,
height: GRID_ITEM_CIRCLE_SIZE,
borderWidth: 1,
borderRadius: BorderRadiuses.br100,
borderColor: Colors.$outlineDisabled
},

containerStyle: {marginBottom: Spacings.s2, marginHorizontal: Spacings.s2, alignContent: 'center'}
});
Loading