Skip to content

Typescript/action sheet #1336

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

Merged
merged 20 commits into from
Jun 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import _ from 'lodash';
const useCases = [
{label: 'Default (Android/iOS)', useNativeIOS: false, icons: false},
{label: 'Default with icons', useNativeIOS: false, icons: true},
{label: 'Native IOS', useNativeIOS: true},
{label: 'Native IOS', useNativeIOS: true}
];
const collectionsIcon = require('../../assets/icons/collections.png');
const starIcon = require('../../assets/icons/star.png');
Expand All @@ -17,11 +17,12 @@ export default class ActionSheetScreen extends Component {
showNative: false,
showCustom: false,
showCustomIcons: false,
pickedOption: undefined
};

pickOption(index) {
pickOption(index: string) {
this.setState({
pickedOption: index,
pickedOption: index
});
}

Expand All @@ -36,7 +37,7 @@ export default class ActionSheetScreen extends Component {
<Button
key={index}
link
size='small'
size={Button.sizes.small}
text50
marginB-10
dark10
Expand All @@ -45,7 +46,7 @@ export default class ActionSheetScreen extends Component {
this.setState({
showNative: useCase.useNativeIOS,
showCustom: !useCase.useNativeIOS && !useCase.icons,
showCustomIcons: !useCase.useNativeIOS && useCase.icons,
showCustomIcons: !useCase.useNativeIOS && useCase.icons
})}
/>
);
Expand All @@ -58,46 +59,47 @@ export default class ActionSheetScreen extends Component {
)}

<ActionSheet
title='Title'
message='Message of action sheet'
title={'Title'}
message={'Message of action sheet'}
cancelButtonIndex={3}
destructiveButtonIndex={0}
useNativeIOS={false}
options={[
{label: 'option 1', onPress: () => this.pickOption('option 1')},
{label: 'option 2', onPress: () => this.pickOption('option 2')},
{label: 'option 3', onPress: () => this.pickOption('option 3')},
{label: 'cancel', onPress: () => this.pickOption('cancel')},
{label: 'cancel', onPress: () => this.pickOption('cancel')}
]}
visible={showCustom}
onDismiss={() => this.setState({showCustom: false})}
/>

<ActionSheet
title='Title'
message='Message of action sheet'
title={'Title'}
message={'Message of action sheet'}
cancelButtonIndex={3}
destructiveButtonIndex={0}
options={[
{label: 'option 1', onPress: () => this.pickOption('option 1'), icon: collectionsIcon},
{label: 'option 2', onPress: () => this.pickOption('option 2'), icon: shareIcon},
{label: 'option 1', onPress: () => this.pickOption('option 1'), iconSource: collectionsIcon},
{label: 'option 2', onPress: () => this.pickOption('option 2'), iconSource: shareIcon},
// `icon` prop will be deprecated, please use `iconSource`
{label: 'option 3', onPress: () => this.pickOption('option 3'), icon: starIcon},
{label: 'cancel', onPress: () => this.pickOption('cancel')},
{label: 'cancel', onPress: () => this.pickOption('cancel')}
]}
visible={showCustomIcons}
onDismiss={() => this.setState({showCustomIcons: false})}
/>

<ActionSheet
title='Title'
message='Message of action sheet'
title={'Title'}
message={'Message of action sheet'}
cancelButtonIndex={3}
destructiveButtonIndex={0}
options={[
{label: 'option 1', onPress: () => this.pickOption('option 1')},
{label: 'option 2', onPress: () => this.pickOption('option 2')},
{label: 'option 3', onPress: () => this.pickOption('option 3')},
{label: 'cancel', onPress: () => this.pickOption('cancel')},
{label: 'cancel', onPress: () => this.pickOption('cancel')}
]}
visible={showNative}
useNativeIOS
Expand Down
2 changes: 1 addition & 1 deletion generatedTypes/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export {default as PanDismissibleView, PanDismissibleViewPropTypes, DismissibleA
export {default as Dialog, DialogProps} from './components/dialog';
export {default as PageControl, PageControlProps} from './components/pageControl';
export {default as Carousel, CarouselProps} from './components/carousel';
export {default as ActionSheet} from './components/actionSheet';

/* All components with manual typings */
export {
ActionSheet,
ConnectionStatusBar,
FeatureHighlight,
Hint,
Expand Down
252 changes: 0 additions & 252 deletions src/components/actionSheet/index.js

This file was deleted.

Loading