Skip to content

Commit a782467

Browse files
feat: adding web support
1 parent bab65ef commit a782467

File tree

12 files changed

+1475
-377
lines changed

12 files changed

+1475
-377
lines changed

.eslintignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
node_modules
2+
example
3+
website
4+
lib
5+
scripts
6+
babel.config.js
7+
*.test.tsx

.eslintrc.json

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
{
2+
"root": true,
3+
"plugins": [
4+
"babel",
5+
"jest-dom",
6+
"jest",
7+
"markdown",
8+
"prettier",
9+
"react-hooks",
10+
"sort-destructure-keys"
11+
],
12+
"extends": [
13+
"eslint:recommended",
14+
"plugin:react/recommended",
15+
"plugin:prettier/recommended",
16+
"plugin:jest/all",
17+
"plugin:jest-dom/recommended"
18+
],
19+
"rules": {
20+
"array-callback-return": 2,
21+
"arrow-body-style": 2,
22+
"comma-dangle": 0,
23+
"babel/no-invalid-this": 2,
24+
"default-case": 2,
25+
"eqeqeq": [2, "smart"],
26+
"jest/expect-expect": 0,
27+
"jest/no-conditional-expect": 0,
28+
"jsx-quotes": ["error", "prefer-single"],
29+
"linebreak-style": [2, "unix"],
30+
"no-console": 0,
31+
"no-mixed-spaces-and-tabs": 1,
32+
"no-self-compare": 2,
33+
"no-underscore-dangle": [2, { "allowAfterThis": true }],
34+
"no-unused-vars": [1, { "ignoreRestSiblings": true }],
35+
"no-use-before-define": 0, // can throw incorrect errors due to mismatch of @typescript-eslint versions in react-scripts and local package.json
36+
"@typescript-eslint/no-use-before-define": 0,
37+
"no-useless-concat": 2,
38+
"no-var": 2,
39+
"object-shorthand": 1,
40+
"prefer-const": 1,
41+
"react/jsx-sort-props": [
42+
"error",
43+
{
44+
"callbacksLast": false,
45+
"ignoreCase": true,
46+
"noSortAlphabetically": false,
47+
"reservedFirst": false,
48+
"shorthandFirst": false,
49+
"shorthandLast": false
50+
}
51+
],
52+
"react/prop-types": 0,
53+
"require-await": 2,
54+
"semi": [1, "always"],
55+
"sort-destructure-keys/sort-destructure-keys": [
56+
2,
57+
{ "caseSensitive": false }
58+
],
59+
"sort-imports": [
60+
"error",
61+
{
62+
"allowSeparatedGroups": true,
63+
"ignoreCase": true,
64+
"ignoreDeclarationSort": true,
65+
"ignoreMemberSort": false,
66+
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
67+
}
68+
],
69+
"sort-keys": [
70+
"error",
71+
"asc",
72+
{ "caseSensitive": false, "minKeys": 2, "natural": false }
73+
],
74+
"valid-typeof": 2,
75+
"import/prefer-default-export": 0,
76+
"import/extensions": [0],
77+
"max-classes-per-file": 0,
78+
"camelcase": 0,
79+
"react-hooks/rules-of-hooks": 1,
80+
"react-hooks/exhaustive-deps": 0,
81+
"jest/prefer-inline-snapshots": 0,
82+
"jest/lowercase-name": 0,
83+
"jest/prefer-expect-assertions": 0,
84+
"jest/no-hooks": 0,
85+
"no-unused-expressions": "off",
86+
"babel/no-unused-expressions": "error",
87+
"jest/no-if": "off"
88+
},
89+
"env": {
90+
"es6": true,
91+
"browser": true
92+
},
93+
"parser": "babel-eslint",
94+
"parserOptions": {
95+
// "allowImportExportEverywhere": true,
96+
"sourceType": "module",
97+
"ecmaVersion": 2018,
98+
"ecmaFeatures": {
99+
"modules": true
100+
}
101+
},
102+
"settings": {
103+
"react": {
104+
"pragma": "React",
105+
"version": "detect"
106+
},
107+
"import/resolver": {
108+
"alias": {
109+
"map": [["mock-builders", "./src/mock-builders"]],
110+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
111+
},
112+
"eslint-import-resolver-babel-module": {},
113+
"node": {
114+
"extensions": [".js", ".jsx", ".ts", ".tsx"],
115+
"paths": ["src"]
116+
}
117+
}
118+
},
119+
"overrides": [
120+
{
121+
"files": ["*.md"],
122+
"rules": {
123+
"react/jsx-no-undef": 0,
124+
"react/react-in-jsx-scope": 0,
125+
"semi": 0,
126+
"no-undef": 0
127+
}
128+
},
129+
{
130+
"env": {
131+
"es6": true,
132+
"browser": true
133+
},
134+
"extends": [
135+
"eslint:recommended",
136+
"plugin:@typescript-eslint/recommended",
137+
"plugin:jest/recommended",
138+
"plugin:prettier/recommended",
139+
"plugin:react/recommended",
140+
"prettier/@typescript-eslint"
141+
],
142+
"files": ["**/*.ts", "**/*.tsx"],
143+
"parser": "@typescript-eslint/parser",
144+
"parserOptions": {
145+
"ecmaFeatures": {
146+
"modules": true,
147+
"jsx": true
148+
},
149+
"ecmaVersion": 2018,
150+
"sourceType": "module"
151+
},
152+
"plugins": [
153+
"@typescript-eslint",
154+
"babel",
155+
"markdown",
156+
"prettier",
157+
"react",
158+
"typescript-sort-keys",
159+
"sort-destructure-keys"
160+
],
161+
"rules": {
162+
"@typescript-eslint/explicit-module-boundary-types": 0,
163+
"@typescript-eslint/no-empty-interface": 0,
164+
"@typescript-eslint/ban-ts-comment": 0,
165+
"@typescript-eslint/no-unused-vars": 1,
166+
"@typescript-eslint/no-var-requires": 0,
167+
"react-hooks/exhaustive-deps": 0,
168+
"react-native/no-inline-styles": 0,
169+
"array-callback-return": 2,
170+
"arrow-body-style": 2,
171+
"comma-dangle": 0,
172+
"babel/no-invalid-this": 2,
173+
"default-case": 2,
174+
"eqeqeq": [2, "smart"],
175+
"linebreak-style": [2, "unix"],
176+
"jsx-quotes": ["error", "prefer-single"],
177+
"no-console": 0,
178+
"no-mixed-spaces-and-tabs": 1,
179+
"no-self-compare": 2,
180+
"no-shadow": 0,
181+
"no-underscore-dangle": [2, { "allowAfterThis": true }],
182+
"no-unused-vars": [1, { "ignoreRestSiblings": true }],
183+
"no-useless-concat": 2,
184+
"no-var": 2,
185+
"object-shorthand": 1,
186+
"prefer-const": 1,
187+
"react/jsx-sort-props": [
188+
"error",
189+
{
190+
"callbacksLast": false,
191+
"ignoreCase": true,
192+
"noSortAlphabetically": false,
193+
"reservedFirst": false,
194+
"shorthandFirst": false,
195+
"shorthandLast": false
196+
}
197+
],
198+
"react/prop-types": 0,
199+
"require-await": 2,
200+
"semi": [1, "always"],
201+
"sort-destructure-keys/sort-destructure-keys": [
202+
2,
203+
{ "caseSensitive": false }
204+
],
205+
"sort-imports": [
206+
"error",
207+
{
208+
"allowSeparatedGroups": true,
209+
"ignoreCase": true,
210+
"ignoreDeclarationSort": true,
211+
"ignoreMemberSort": false,
212+
"memberSyntaxSortOrder": ["none", "all", "multiple", "single"]
213+
}
214+
],
215+
"sort-keys": [
216+
"error",
217+
"asc",
218+
{ "caseSensitive": false, "minKeys": 2, "natural": false }
219+
],
220+
"typescript-sort-keys/interface": [
221+
"error",
222+
"asc",
223+
{ "caseSensitive": false, "natural": true, "requiredFirst": true }
224+
],
225+
"typescript-sort-keys/string-enum": [
226+
"error",
227+
"asc",
228+
{ "caseSensitive": false, "natural": true }
229+
],
230+
"valid-typeof": 2
231+
}
232+
}
233+
]
234+
}

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
website/
3+
example/

.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"arrowParens": "always",
3+
"jsxSingleQuote": true,
4+
"singleQuote": true,
5+
"tabWidth": 2,
6+
"trailingComma": "all"
7+
}

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414

1515
[FlatList](https://reactnative.dev/docs/flatlist) by react-native only allows infinite scroll in one direction (using `onEndReached`). This package adds capability on top of FlatList to allow infinite scroll from both directions, and also maintains **smooth scroll** UX.
1616

17-
- Accepts prop `onStartReached` & `onEndReached`, which you can use to load more results.
17+
- Accepts prop `onStartReached` & `onEndReached`, which you can use to load more results.
1818
- Calls to onEndReached and onStartReached have been optimized.
1919
- Inline loading Indicators, which can be customized as well.
2020
- Uses [flat-list-mvcp](https://github.com/GetStream/flat-list-mvcp#maintainvisiblecontentposition-prop-support-for-android-react-native) to maintain scroll position or smooth scroll UX.
2121

22-
2322
<table>
2423
<tr>
2524
<td align='center' width="33%"><img src='https://user-images.githubusercontent.com/11586388/109138261-77774800-775a-11eb-806b-2add75755af7.gif' height="600" /></td>

package.json

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"version": "0.3.3",
44
"description": "Birectional infinite scroll for react-native",
55
"main": "lib/commonjs/index",
6-
"module": "lib/module/index",
6+
"module": "src/index",
7+
"web": "src/index",
78
"types": "lib/typescript/index.d.ts",
89
"react-native": "src/index",
910
"source": "src/index",
@@ -25,6 +26,8 @@
2526
"test": "jest",
2627
"typescript": "tsc --noEmit",
2728
"lint": "eslint \"**/*.{js,ts,tsx}\"",
29+
"prettier": "prettier --list-different '**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc babel.config.js",
30+
"prettier-fix": "prettier --write '**/*.{js,ts,tsx,md,json}' .eslintrc.json .prettierrc babel.config.js",
2831
"prepare": "bob build",
2932
"release": "release-it",
3033
"example": "yarn --cwd example",
@@ -49,24 +52,38 @@
4952
"devDependencies": {
5053
"@commitlint/config-conventional": "^11.0.0",
5154
"@react-native-community/eslint-config": "^2.0.0",
55+
"@react-native-community/eslint-plugin": "1.1.0",
5256
"@release-it/conventional-changelog": "^2.0.0",
5357
"@stream-io/flat-list-mvcp": "^0.10.0",
58+
"@types/eslint": "7.2.6",
5459
"@types/jest": "^26.0.0",
5560
"@types/react": "^16.9.19",
5661
"@types/react-native": "0.63.50",
62+
"@typescript-eslint/eslint-plugin": "4.15.0",
63+
"@typescript-eslint/parser": "4.15.0",
64+
"babel-eslint": "10.1.0",
5765
"commitlint": "^11.0.0",
5866
"eslint": "^7.2.0",
59-
"eslint-config-prettier": "^7.0.0",
67+
"eslint-config-prettier": "7.2.0",
68+
"eslint-plugin-babel": "5.3.1",
69+
"eslint-plugin-jest": "24.1.3",
70+
"eslint-plugin-jest-dom": "^3.8.0",
71+
"eslint-plugin-markdown": "1.0.2",
6072
"eslint-plugin-prettier": "^3.1.3",
73+
"eslint-plugin-react": "7.22.0",
74+
"eslint-plugin-sort-destructure-keys": "1.3.5",
75+
"eslint-plugin-typescript-sort-keys": "1.5.0",
6176
"husky": "^4.2.5",
6277
"jest": "^26.0.1",
6378
"pod-install": "^0.1.0",
6479
"prettier": "^2.0.5",
6580
"react": "16.13.1",
81+
"react-dom": "^17.0.2",
6682
"react-native": "0.63.4",
6783
"react-native-builder-bob": "^0.17.1",
84+
"react-virtuoso": "^1.6.0",
6885
"release-it": "^14.2.2",
69-
"typescript": "^4.1.3"
86+
"typescript": "3.9.6"
7087
},
7188
"peerDependencies": {
7289
"@stream-io/flat-list-mvcp": ">=0.10.0",

0 commit comments

Comments
 (0)