forked from storybookjs/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ability to exclude paths for stories (storybookjs#285)
- Loading branch information
Showing
9 changed files
with
134 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
app/react-native/scripts/__snapshots__/loader.test.js.snap
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
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
app/react-native/scripts/mocks/exclude-config-files/exclude-components/FakeComponent.tsx
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 @@ | ||
export const FakeComponent = () => null; |
10 changes: 10 additions & 0 deletions
10
app/react-native/scripts/mocks/exclude-config-files/exclude-components/FakeStory.stories.tsx
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,10 @@ | ||
import { FakeComponentExcluded } from './FakeComponent'; | ||
|
||
export default { | ||
title: 'components/FakeComponentExcluded', | ||
component: FakeComponentExcluded, | ||
}; | ||
|
||
export const Basic = { | ||
args: {}, | ||
}; |
1 change: 1 addition & 0 deletions
1
app/react-native/scripts/mocks/exclude-config-files/include-components/FakeComponent.tsx
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 @@ | ||
export const FakeComponent = () => null; |
10 changes: 10 additions & 0 deletions
10
app/react-native/scripts/mocks/exclude-config-files/include-components/FakeStory.stories.tsx
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,10 @@ | ||
import { FakeComponent } from './FakeComponent'; | ||
|
||
export default { | ||
title: 'components/FakeComponent', | ||
component: FakeComponent, | ||
}; | ||
|
||
export const Basic = { | ||
args: {}, | ||
}; |
12 changes: 12 additions & 0 deletions
12
app/react-native/scripts/mocks/exclude-config-files/main.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,12 @@ | ||
module.exports = { | ||
stories: ['**/*.stories.tsx'], | ||
reactNativeOptions: { | ||
excludePaths: '**/exclude-components/**', | ||
}, | ||
addons: [ | ||
'@storybook/addon-ondevice-notes', | ||
'@storybook/addon-ondevice-controls', | ||
'@storybook/addon-ondevice-backgrounds', | ||
'@storybook/addon-ondevice-actions', | ||
], | ||
}; |
24 changes: 24 additions & 0 deletions
24
app/react-native/scripts/mocks/exclude-config-files/preview.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,24 @@ | ||
import React from 'react'; | ||
import { View, StyleSheet } from 'react-native'; | ||
import { withBackgrounds } from '@storybook/addon-ondevice-backgrounds'; | ||
|
||
export const decorators = [ | ||
(StoryFn) => ( | ||
<View style={styles.container}> | ||
<StoryFn /> | ||
</View> | ||
), | ||
withBackgrounds, | ||
]; | ||
export const parameters = { | ||
my_param: 'anything', | ||
backgrounds: [ | ||
{ name: 'plain', value: 'white', default: true }, | ||
{ name: 'warm', value: 'hotpink' }, | ||
{ name: 'cool', value: 'deepskyblue' }, | ||
], | ||
}; | ||
|
||
const styles = StyleSheet.create({ | ||
container: { padding: 8, flex: 1 }, | ||
}); |