-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(react-native): upgrade @storybook/react-native to 6.5
- Loading branch information
Showing
19 changed files
with
167 additions
and
178 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
// options from https://github.com/elderfo/react-native-storybook-loader#options | ||
export interface ReactNativeStorybookOptions { | ||
searchDir: string[]; | ||
outputFile: string; | ||
pattern: string; | ||
/** | ||
* @deprecated going to be removed in 17 | ||
*/ | ||
silent: boolean; | ||
} |
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
48 changes: 28 additions & 20 deletions
48
...act-native/src/generators/component-story/files/__componentFileName__.stories.__fileExt__
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,24 +1,32 @@ | ||
<% if (hasActions) { %> | ||
import { action } from '@storybook/addon-actions'; | ||
<% } %> | ||
import { storiesOf } from '@storybook/react-native'; | ||
import React from 'react'; | ||
import { | ||
<%= componentName %> | ||
<% if ( propsTypeName ) { %>, <%= propsTypeName %> <% } %> | ||
} from './<%= componentImportFileName %>'; | ||
<% if ( !isPlainJs ) { %>import type { Meta } from '@storybook/react-native';<% } %> | ||
import<% if ( !isPlainJs ) { %> { <% } %> <%= componentName %> <% if ( !isPlainJs ) { %> } <% } %> from './<%= componentImportFileName %>'; | ||
|
||
<% if (hasActions) { %> | ||
const actions = {<% for (let argType of argTypes) { %> | ||
<%= argType.name %>: action('<%- argType.actionText %>'), | ||
<% } %>}; | ||
<% if ( isPlainJs ) { %> | ||
export default { | ||
component: <%= componentName %>, | ||
title: '<%= componentName %>',<% if ( argTypes && argTypes.length > 0 ) { %> | ||
argTypes: {<% for (let argType of argTypes) { %> | ||
<%= argType.name %>: { <%- argType.type %> : "<%- argType.actionText %>" },<% } %> | ||
} | ||
<% } %> | ||
}; | ||
<% } %> | ||
|
||
const props <% if ( propsTypeName ) { %>:<%= propsTypeName %><% } %> = {<% for (let prop of props) { %> | ||
<%= prop.name %>: <%- prop.defaultValue %>, | ||
<% } %>}; | ||
|
||
storiesOf('<%= componentName %>', module) | ||
.add('Primary', () => ( | ||
<<%= componentName %> {...props} <% if (hasActions) { %> {...actions} <% } %>/> | ||
)); | ||
<% if ( !isPlainJs ) { %> | ||
const Story: Meta<typeof <%= componentName %>> = { | ||
component: <%= componentName %>, | ||
title: '<%= componentName %>',<% if ( argTypes && argTypes.length > 0 ) { %> | ||
argTypes: {<% for (let argType of argTypes) { %> | ||
<%= argType.name %>: { <%- argType.type %> : "<%- argType.actionText %>" },<% } %> | ||
} | ||
<% } %> | ||
}; | ||
export default Story; | ||
<% } %> | ||
|
||
export const Primary = { | ||
args: {<% for (let prop of props) { %> | ||
<%= prop.name %>: <%- prop.defaultValue %>,<% } %> | ||
}, | ||
}; |
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
Oops, something went wrong.