├── .gitignore
├── README.md
├── config
├── dev.js
├── index.js
└── prod.js
├── package.json
└── src
├── app.jsx
├── app.scss
├── index.html
└── pages
└── index
├── index.jsx
└── index.scss
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Taro 高性能瀑布流组件(for RN)
2 |
3 | > 解决安卓低端机下拉下加载卡顿问题
--------------------------------------------------------------------------------
/config/dev.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | NODE_ENV: '"development"'
4 | },
5 | defineConstants: {
6 | },
7 | weapp: {},
8 | h5: {}
9 | }
10 |
--------------------------------------------------------------------------------
/config/index.js:
--------------------------------------------------------------------------------
1 | const config = {
2 | projectName: 'taro-waterfall',
3 | date: '2019-8-10',
4 | designWidth: 750,
5 | deviceRatio: {
6 | '640': 2.34 / 2,
7 | '750': 1,
8 | '828': 1.81 / 2
9 | },
10 | sourceRoot: 'src',
11 | outputRoot: 'dist',
12 | plugins: {
13 | babel: {
14 | sourceMap: true,
15 | presets: [
16 | ['env', {
17 | modules: false
18 | }]
19 | ],
20 | plugins: [
21 | 'transform-decorators-legacy',
22 | 'transform-class-properties',
23 | 'transform-object-rest-spread'
24 | ]
25 | }
26 | },
27 | defineConstants: {
28 | },
29 | copy: {
30 | patterns: [
31 | ],
32 | options: {
33 | }
34 | },
35 | weapp: {
36 | module: {
37 | postcss: {
38 | autoprefixer: {
39 | enable: true,
40 | config: {
41 | browsers: [
42 | 'last 3 versions',
43 | 'Android >= 4.1',
44 | 'ios >= 8'
45 | ]
46 | }
47 | },
48 | pxtransform: {
49 | enable: true,
50 | config: {
51 |
52 | }
53 | },
54 | url: {
55 | enable: true,
56 | config: {
57 | limit: 10240 // 设定转换尺寸上限
58 | }
59 | },
60 | cssModules: {
61 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
62 | config: {
63 | namingPattern: 'module', // 转换模式,取值为 global/module
64 | generateScopedName: '[name]__[local]___[hash:base64:5]'
65 | }
66 | }
67 | }
68 | }
69 | },
70 | h5: {
71 | publicPath: '/',
72 | staticDirectory: 'static',
73 | module: {
74 | postcss: {
75 | autoprefixer: {
76 | enable: true,
77 | config: {
78 | browsers: [
79 | 'last 3 versions',
80 | 'Android >= 4.1',
81 | 'ios >= 8'
82 | ]
83 | }
84 | },
85 | cssModules: {
86 | enable: false, // 默认为 false,如需使用 css modules 功能,则设为 true
87 | config: {
88 | namingPattern: 'module', // 转换模式,取值为 global/module
89 | generateScopedName: '[name]__[local]___[hash:base64:5]'
90 | }
91 | }
92 | }
93 | }
94 | }
95 | }
96 |
97 | module.exports = function (merge) {
98 | if (process.env.NODE_ENV === 'development') {
99 | return merge({}, config, require('./dev'))
100 | }
101 | return merge({}, config, require('./prod'))
102 | }
103 |
--------------------------------------------------------------------------------
/config/prod.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | NODE_ENV: '"production"'
4 | },
5 | defineConstants: {
6 | },
7 | weapp: {},
8 | h5: {
9 | /**
10 | * 如果h5端编译后体积过大,可以使用webpack-bundle-analyzer插件对打包体积进行分析。
11 | * 参考代码如下:
12 | * webpackChain (chain) {
13 | * chain.plugin('analyzer')
14 | * .use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin, [])
15 | * }
16 | */
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "taro-waterfall",
3 | "version": "1.0.0",
4 | "private": true,
5 | "description": "Taro 高性能瀑布流组件(for RN)",
6 | "templateInfo": {
7 | "name": "default",
8 | "typescript": false,
9 | "css": "sass"
10 | },
11 | "scripts": {
12 | "build:weapp": "taro build --type weapp",
13 | "build:swan": "taro build --type swan",
14 | "build:alipay": "taro build --type alipay",
15 | "build:tt": "taro build --type tt",
16 | "build:h5": "taro build --type h5",
17 | "build:rn": "taro build --type rn",
18 | "dev:weapp": "npm run build:weapp -- --watch",
19 | "dev:swan": "npm run build:swan -- --watch",
20 | "dev:alipay": "npm run build:alipay -- --watch",
21 | "dev:tt": "npm run build:tt -- --watch",
22 | "dev:h5": "npm run build:h5 -- --watch",
23 | "dev:rn": "npm run build:rn -- --watch"
24 | },
25 | "author": "",
26 | "license": "MIT",
27 | "dependencies": {
28 | "@tarojs/components": "1.3.9",
29 | "@tarojs/router": "1.3.9",
30 | "@tarojs/taro": "1.3.9",
31 | "@tarojs/taro-alipay": "1.3.9",
32 | "@tarojs/taro-h5": "1.3.9",
33 | "@tarojs/taro-swan": "1.3.9",
34 | "@tarojs/taro-tt": "1.3.9",
35 | "@tarojs/taro-weapp": "1.3.9",
36 | "nervjs": "^1.4.0",
37 | "nerv-devtools": "^1.4.0"
38 | },
39 | "devDependencies": {
40 | "@types/react": "^16.4.6",
41 | "@types/webpack-env": "^1.13.6",
42 | "@tarojs/plugin-babel": "1.3.9",
43 | "@tarojs/plugin-csso": "1.3.9",
44 | "@tarojs/plugin-sass": "1.3.9",
45 | "@tarojs/plugin-uglifyjs": "1.3.9",
46 | "@tarojs/webpack-runner": "1.3.9",
47 | "babel-plugin-transform-class-properties": "^6.24.1",
48 | "babel-plugin-transform-decorators-legacy": "^1.3.4",
49 | "babel-plugin-transform-jsx-stylesheet": "^0.6.5",
50 | "babel-plugin-transform-object-rest-spread": "^6.26.0",
51 | "babel-preset-env": "^1.6.1",
52 | "babel-eslint": "^8.2.3",
53 | "eslint": "^5.16.0",
54 | "eslint-config-taro": "1.3.9",
55 | "eslint-plugin-react": "^7.8.2",
56 | "eslint-plugin-import": "^2.12.0",
57 | "stylelint": "9.3.0",
58 | "stylelint-config-taro-rn": "1.3.9",
59 | "stylelint-taro-rn": "1.3.9",
60 | "eslint-plugin-taro": "1.3.9"
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/app.jsx:
--------------------------------------------------------------------------------
1 | import Taro, { Component } from '@tarojs/taro'
2 | import Index from './pages/index'
3 |
4 | import './app.scss'
5 |
6 | // 如果需要在 h5 环境中开启 React Devtools
7 | // 取消以下注释:
8 | // if (process.env.NODE_ENV !== 'production' && process.env.TARO_ENV === 'h5') {
9 | // require('nerv-devtools')
10 | // }
11 |
12 | class App extends Component {
13 |
14 | config = {
15 | pages: [
16 | 'pages/index/index'
17 | ],
18 | window: {
19 | backgroundTextStyle: 'light',
20 | navigationBarBackgroundColor: '#fff',
21 | navigationBarTitleText: 'WeChat',
22 | navigationBarTextStyle: 'black'
23 | }
24 | }
25 |
26 | componentDidMount () {}
27 |
28 | componentDidShow () {}
29 |
30 | componentDidHide () {}
31 |
32 | componentDidCatchError () {}
33 |
34 | // 在 App 类中的 render() 函数没有实际作用
35 | // 请勿修改此函数
36 | render () {
37 | return (
38 |