Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12405 from storybookjs/fix/react-native-cli-init
CLI: Workaround for react native `sb init`
- Loading branch information
Showing
10 changed files
with
82 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
lib/cli/src/generators/REACT_NATIVE/template-csf/storybook/addons.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
import '@storybook/addon-actions/register'; | ||
import '@storybook/addon-links/register'; | ||
import '@storybook/addon-knobs/register'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import '@storybook/addon-ondevice-actions/register'; | ||
import '@storybook/addon-ondevice-knobs/register'; |
20 changes: 20 additions & 0 deletions
20
lib/cli/src/generators/REACT_NATIVE/template-csf/storybook/stories/Button/Button.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { action } from '@storybook/addon-actions'; | ||
import { text } from '@storybook/addon-knobs'; | ||
import { storiesOf } from '@storybook/react-native'; | ||
import React from 'react'; | ||
import { Text } from 'react-native'; | ||
import Button from '.'; | ||
import CenterView from '../CenterView'; | ||
|
||
storiesOf('Button', module) | ||
.addDecorator((getStory) => <CenterView>{getStory()}</CenterView>) | ||
.add('with text', () => ( | ||
<Button onPress={action('clicked-text')}> | ||
<Text>{text('Button text', 'Hello Button')}</Text> | ||
</Button> | ||
)) | ||
.add('with some emoji', () => ( | ||
<Button onPress={action('clicked-emoji')}> | ||
<Text>😀 😎 👍 💯</Text> | ||
</Button> | ||
)); |
17 changes: 0 additions & 17 deletions
17
lib/cli/src/generators/REACT_NATIVE/template-csf/storybook/stories/Button/index.android.js
This file was deleted.
Oops, something went wrong.
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
...cli/src/generators/REACT_NATIVE/template-csf/storybook/stories/Welcome/Welcome.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import React from 'react'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
import { storiesOf } from '@storybook/react-native'; | ||
import Welcome from '.'; | ||
|
||
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />); |
27 changes: 2 additions & 25 deletions
27
lib/cli/src/generators/REACT_NATIVE/template-csf/storybook/stories/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,2 @@ | ||
import React from 'react'; | ||
import { Text } from 'react-native'; | ||
|
||
import { storiesOf } from '@storybook/react-native'; | ||
import { action } from '@storybook/addon-actions'; | ||
import { linkTo } from '@storybook/addon-links'; | ||
|
||
import Button from './Button'; | ||
import CenterView from './CenterView'; | ||
import Welcome from './Welcome'; | ||
|
||
storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />); | ||
|
||
storiesOf('Button', module) | ||
.addDecorator((getStory) => <CenterView>{getStory()}</CenterView>) | ||
.add('with text', () => ( | ||
<Button onPress={action('clicked-text')}> | ||
<Text>Hello Button</Text> | ||
</Button> | ||
)) | ||
.add('with some emoji', () => ( | ||
<Button onPress={action('clicked-emoji')}> | ||
<Text>😀 😎 👍 💯</Text> | ||
</Button> | ||
)); | ||
import './Button/Button.stories'; | ||
import './Welcome/Welcome.stories'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters