Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0bd7aba

Browse files
committedOct 3, 2017
Add initial example bare repo
TODO: format command, eslint, jest, flow
0 parents  commit 0bd7aba

File tree

12 files changed

+182
-0
lines changed

12 files changed

+182
-0
lines changed
 

‎.gitignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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

‎.npmignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
*.test.js
2+
__snapshots/**
3+
.babelrc
4+
.eslintrc
5+
.eslintignore
6+
.flowconfig
7+
.yarn.lock
8+
.gitattributes
9+
.prettierrc
10+
docs/
11+
.idea

‎.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"printWidth": 120,
3+
"singleQuote": true,
4+
"trailingComma": "es5"
5+
}

‎README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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!

‎docs/.storybook/addons.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@storybook/addon-options/register';

‎docs/.storybook/config.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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);

‎docs/.storybook/decorator-centered.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
}

‎docs/.storybook/webpack.config.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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: /\.js$/,
9+
exclude: /node_modules/,
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+
};

‎docs/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
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+
}

‎docs/stories/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
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 />);

‎package.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

‎src/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default () => null;

0 commit comments

Comments
 (0)
Please sign in to comment.