Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit bf599e6

Browse files
committed
Initial commit
0 parents  commit bf599e6

File tree

11 files changed

+167
-0
lines changed

11 files changed

+167
-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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# react-native-web-lists
2+
> React Native for Web implementation of Lists
3+
4+
This package uses the legacy implementation (ListView).
5+
6+
## Getting started
7+
`$ npm install react-native-web-lists --save`
8+
9+
Alias the package in your webpack config:
10+
11+
```
12+
resolve: {
13+
alias: {
14+
'react-native': 'react-native-web',
15+
...
16+
'FlatList': 'react-native-web-lists/FlatList',
17+
'SectionList': 'react-native-web-lists/SectionList',
18+
}
19+
}
20+
```
21+
22+
## Usage
23+
```js
24+
import FlatList from 'FlatList'; // don't import from react-native
25+
import SectionList from 'SectionList'; // don't import from react-native
26+
```
27+
28+
See [RN's docs](https://facebook.github.io/react-native/docs/flatlist.html).
29+
30+
## Examples
31+
See the [storybook](https://react-native-web-community.github.io/react-native-web-lists/storybook).
32+
33+
## Contributing
34+
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: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { setOptions } from '@storybook/addon-options';
2+
import { configure } from '@storybook/react';
3+
4+
setOptions({
5+
name: 'Lists',
6+
url: 'https://react-native-web-community.github.io/react-native-web-lists',
7+
goFullScreen: false,
8+
showLeftPanel: true,
9+
showDownPanel: false,
10+
downPanelInRight: false
11+
});
12+
13+
function loadStories() {
14+
require('../stories');
15+
}
16+
17+
configure(loadStories, module);

docs/.storybook/webpack.config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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+
};
26+
27+
return storybookBaseConfig;
28+
};

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+
}

0 commit comments

Comments
 (0)