Skip to content

Instantly share code, notes, and snippets.

@trooperandz
Last active November 15, 2021 02:08
Show Gist options
  • Save trooperandz/be1b0c4192906f705b2af75cbbca4ce4 to your computer and use it in GitHub Desktop.
Save trooperandz/be1b0c4192906f705b2af75cbbca4ce4 to your computer and use it in GitHub Desktop.
React Native Storybook Button story file
// storybook/Button/index.stories.js
import React from 'react';
import { storiesOf } from '@storybook/react-native';
import { action } from '@storybook/addon-actions';
import { text, select, boolean } from '@storybook/addon-knobs';
import { CenterView } from '../CenterView';
import { Button } from '.';
const typeOptions = ['primary', 'secondary', 'tertiary'];
const iconOptions = ['none', 'search'];
storiesOf('components/Button', module)
.addDecorator(getStory => <CenterView>{getStory()}</CenterView>)
.add('Full demo', () => (
<Button
iconType={select('icon', iconOptions, iconOptions[0])}
isLoading={boolean('isLoading', false)}
onPress={action('onPress executed')}
text={text('text', 'Submit')}
type={select('type', typeOptions, typeOptions[0])}
/>
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment