File tree Expand file tree Collapse file tree 12 files changed +182
-0
lines changed Expand file tree Collapse file tree 12 files changed +182
-0
lines changed Original file line number Diff line number Diff line change
1
+ # OSX
2
+ #
3
+ .DS_Store
4
+
5
+ # node.js
6
+ #
7
+ node_modules /
8
+ npm-debug.log
9
+ yarn-error.log
10
+
11
+ dist
Original file line number Diff line number Diff line change
1
+ * .test.js
2
+ __snapshots /**
3
+ .babelrc
4
+ .eslintrc
5
+ .eslintignore
6
+ .flowconfig
7
+ .yarn.lock
8
+ .gitattributes
9
+ .prettierrc
10
+ docs /
11
+ .idea
Original file line number Diff line number Diff line change
1
+ {
2
+ "printWidth": 120,
3
+ "singleQuote": true,
4
+ "trailingComma": "es5"
5
+ }
Original file line number Diff line number Diff line change
1
+ # react-native-web-{name}
2
+ > React Native for Web implementation of {target module}
3
+
4
+ ## Getting started
5
+ ` $ npm install react-native-web-{name} --save `
6
+
7
+ Alias the package in your webpack config:
8
+
9
+ ```
10
+ resolve: {
11
+ alias: {
12
+ 'react-native': 'react-native-web',
13
+ ...
14
+ '{target-module}': 'react-native-web-{name}',
15
+ }
16
+ }
17
+ ```
18
+
19
+ ## Usage
20
+ { add link to the original module's docs }
21
+
22
+ { if only some props are supported, list them }
23
+
24
+ { if there are web-specific props, list them }
25
+
26
+ ## Examples
27
+ See the [ storybook] ( https://react-native-web-community.github.io/react-native-web-{name}/storybook ) .
28
+
29
+ ## Contributing
30
+ PRs are welcome!
Original file line number Diff line number Diff line change
1
+ import '@storybook/addon-options/register' ;
Original file line number Diff line number Diff line change
1
+ import { setOptions } from '@storybook/addon-options' ;
2
+ import { configure , addDecorator } from '@storybook/react' ;
3
+ import centered from './decorator-centered' ;
4
+
5
+ addDecorator ( centered ) ;
6
+
7
+ setOptions ( {
8
+ name : 'Name' ,
9
+ url : 'https://react-native-web-community.github.io/react-native-web-name' ,
10
+ goFullScreen : false ,
11
+ showLeftPanel : true ,
12
+ showDownPanel : false ,
13
+ downPanelInRight : false
14
+ } ) ;
15
+
16
+ function loadStories ( ) {
17
+ require ( '../stories' ) ;
18
+ }
19
+
20
+ configure ( loadStories , module ) ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { StyleSheet , View } from 'react-native' ;
3
+
4
+ const styles = StyleSheet . create ( {
5
+ root : {
6
+ flex : 1 ,
7
+ alignItems : 'center' ,
8
+ justifyContent : 'center' ,
9
+ minHeight : '100vh' ,
10
+ } ,
11
+ } ) ;
12
+
13
+ export default function ( renderStory ) {
14
+ return < View style = { styles . root } > { renderStory ( ) } </ View > ;
15
+ }
Original file line number Diff line number Diff line change
1
+ const path = require ( 'path' ) ;
2
+ const webpack = require ( 'webpack' ) ;
3
+
4
+ module . exports = ( storybookBaseConfig , configType ) => {
5
+ const DEV = configType === 'DEVELOPMENT' ;
6
+
7
+ storybookBaseConfig . module . rules . push ( {
8
+ test : / \. j s $ / ,
9
+ exclude : / n o d e _ m o d u l e s / ,
10
+ use : {
11
+ loader : 'babel-loader' ,
12
+ options : { cacheDirectory : true }
13
+ }
14
+ } ) ;
15
+
16
+ storybookBaseConfig . plugins . push (
17
+ new webpack . DefinePlugin ( {
18
+ 'process.env.NODE_ENV' : JSON . stringify ( process . env . NODE_ENV || 'development' ) ,
19
+ 'process.env.__REACT_NATIVE_DEBUG_ENABLED__' : DEV
20
+ } )
21
+ ) ;
22
+
23
+ storybookBaseConfig . resolve . alias = {
24
+ 'react-native' : 'react-native-web' ,
25
+ 'react-native-web-name' : path . join ( __dirname , '../../src/' )
26
+ } ;
27
+
28
+ return storybookBaseConfig ;
29
+ } ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "scripts" : {
3
+ "build" : " yarn && build-storybook -o ./dist -c ./.storybook" ,
4
+ "start" : " start-storybook -p 9001 -c ./.storybook" ,
5
+ "release" : " yarn build && git checkout gh-pages && rm -rf ../storybook && mv dist ../storybook && git add -A && git commit -m \" Storybook deploy\" && git push origin gh-pages && git checkout -"
6
+ },
7
+ "dependencies" : {
8
+ "@storybook/addon-options" : " ^3.2.10" ,
9
+ "@storybook/react" : " ^3.1.9"
10
+ }
11
+ }
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import YourComponent from 'react-native-web-name'
3
+
4
+ import { storiesOf } from '@storybook/react' ;
5
+
6
+ storiesOf ( 'YourComponent' , module ) . add ( 'basic' , ( ) => < YourComponent /> ) ;
Original file line number Diff line number Diff line change
1
+ {
2
+ "name" : " react-native-web-name" ,
3
+ "version" : " 0.0.0" ,
4
+ "description" : " React Native for Web implementation of {target module}" ,
5
+ "main" : " src/index.js" ,
6
+ "repository" : {
7
+ "type" : " git" ,
8
+ "url" : " git@github.com:react-native-web-community/react-native-web-name.git"
9
+ },
10
+ "author" : {
11
+ "name" : " {name}" ,
12
+ "email" : " {email}" ,
13
+ "url" : " {url}"
14
+ },
15
+ "license" : " {license, don't forget to add a LICENSE file at the root of the project}" ,
16
+ "keywords" : [
17
+ " react-native" ,
18
+ " react-native-web" ,
19
+ " {other keywords}"
20
+ ],
21
+ "scripts" : {
22
+ "test" : " echo \" Error: no test specified\" && exit 1"
23
+ },
24
+ "babel" : {
25
+ "presets" : [
26
+ " react-native"
27
+ ]
28
+ },
29
+ "devDependencies" : {
30
+ "babel-core" : " ^6.26.0" ,
31
+ "babel-loader" : " ^7.1.2" ,
32
+ "babel-preset-react-native" : " ^4.0.0" ,
33
+ "prettier" : " ^1.7.3" ,
34
+ "react" : " ^16.0.0" ,
35
+ "react-dom" : " ^16.0.0" ,
36
+ "react-native-web" : " ^0.1.1" ,
37
+ "webpack" : " ^3.6.0"
38
+ },
39
+ "peerDependencies" : {
40
+ "react-native-web" : " *"
41
+ }
42
+ }
Original file line number Diff line number Diff line change
1
+ export default ( ) => null ;
You can’t perform that action at this time.
0 commit comments