This file contains hidden or 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
// in React setup | |
npx -p @storybook/cli sb init --type react | |
// in React Native setup | |
npx -p @storybook/cli sb init --use-npm --type react_native |
This file contains hidden or 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
// React setup | |
"scripts": { | |
"build-storybook": "build-storybook -s public", | |
"storybook": "start-storybook -p 9009 -s public", etc.. | |
} | |
// React Native setup | |
"scripts": { | |
"storybook": "start-storybook -p 6006", etc.. | |
} |
This file contains hidden or 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
module.exports = { | |
stories: ['../stories/**/*.stories.js'], | |
addons: ['@storybook/addon-actions', '@storybook/addon-links'], | |
}; | |
This file contains hidden or 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
// your component written for react-native - how the metro bundler see it | |
import {View, Text} from "react-native"; | |
const MyComponent = () => { | |
return( | |
<View> | |
<Text>Hello</Text> | |
</View> | |
) |
This file contains hidden or 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
module.exports = { | |
stories: ['../storybook/stories/index.js'], | |
webpackFinal: async config => { | |
config.resolve.alias = { | |
...(config.resolve.alias || {}), | |
// Transform all direct `react-native` imports to `react-native-web` | |
'react-native$': 'react-native-web', | |
// make sure we're rendering output using **web** Storybook not react-native | |
'@storybook/react-native': '@storybook/react', | |
// plugin-level react-native-web extensions |
This file contains hidden or 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
{ | |
"name": "example", | |
"version": "0.0.1", | |
"private": true, | |
"scripts": { | |
"android": "react-native run-android", | |
"ios": "react-native run-ios", | |
"start": "react-native start", | |
"test": "jest", | |
"lint": "eslint .", |
This file contains hidden or 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
const {getDefaultConfig} = require('metro-config'); | |
module.exports = (async () => { | |
const { | |
resolver: {sourceExts, assetExts}, | |
} = await getDefaultConfig(); | |
return { | |
transformer: { | |
babelTransformerPath: require.resolve('react-native-svg-transformer'), | |
}, |
This file contains hidden or 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
<svg width="51px" height="53px" viewBox="0 0 51 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> | |
<defs> | |
<filter x="-48.6%" y="-44.7%" width="191.9%" height="189.5%" filterUnits="objectBoundingBox" id="filter-1"> | |
<feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset> | |
<feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur> | |
<feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix> | |
<feMerge> | |
<feMergeNode in="shadowMatrixOuter1"></feMergeNode> | |
<feMergeNode in="SourceGraphic"></feMergeNode> | |
</feMerge> |
This file contains hidden or 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
// handle svg support | |
const fileLoaderRule = config.module.rules.find(rule => | |
rule.test.test('.svg'), | |
); | |
fileLoaderRule.exclude = /\.svg$/; | |
config.module.rules.push({ | |
test: /\.svg$/, | |
loader: 'svg-react-loader', | |
}); |
OlderNewer