diff --git a/config/rollup.config.js b/config/rollup.config.js index 8748c51..889b20c 100644 --- a/config/rollup.config.js +++ b/config/rollup.config.js @@ -62,7 +62,7 @@ export default { }), RollupJson(), RollupTypescript({ - tsconfig: resolveFile('tsconfig.rollup.json') + tsconfig: resolveFile('tsconfig.json') }), RollupCopy({ targets: [ diff --git a/package.json b/package.json index 2007d00..6c872bc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "taro-listview", - "version": "1.4.9", + "version": "1.4.3", "description": "listView pullDownRefresh and skeleton", "templateInfo": { "name": "default", @@ -38,7 +38,7 @@ "dev:tt": "npm run build:tt -- --watch", "dev:h5": "npm run build:h5 -- --watch", "dev:rn": "npm run build:rn -- --watch", - "build:lib": "tsc --project ./tsconfig.build.json", + "build:lib": "tsc --project ./tsconfig.json", "build:rollup": "rollup --config ./config/rollup.config.js", "copy": "node ./scripts/build.js", "types": "tsc -d --emitDeclarationOnly --allowJs false --diagnostics --declarationDir ./@types", @@ -47,7 +47,7 @@ }, "author": "rahim ", "publishConfig": { - "registry": "http://152.136.203.150:4873" + "registry": "https://registry.npmjs.org" }, "repository": { "type": "git", diff --git a/project.config.json b/project.config.json index 353437b..d4eceb2 100644 --- a/project.config.json +++ b/project.config.json @@ -10,8 +10,8 @@ "preloadBackgroundData": false, "minified": false, "newFeature": true, - "autoAudits": false, "coverView": true, + "autoAudits": false, "showShadowRootInWxmlPanel": true, "scopeDataCheck": false, "checkInvalidKey": true, @@ -22,11 +22,43 @@ "disablePlugins": [], "outputPath": "" }, - "useCompilerModule": false + "useCompilerModule": false, + "userConfirmedUseCompilerModuleSwitch": false }, "compileType": "miniprogram", "simulatorType": "wechat", "simulatorPluginLibVersion": {}, "libVersion": "2.10.4", - "condition": {} + "condition": { + "search": { + "current": -1, + "list": [] + }, + "conversation": { + "current": -1, + "list": [] + }, + "plugin": { + "current": -1, + "list": [] + }, + "game": { + "list": [] + }, + "gamePlugin": { + "current": -1, + "list": [] + }, + "miniprogram": { + "current": -1, + "list": [ + { + "id": -1, + "name": "pages/index/index", + "pathName": "pages/index/index", + "scene": null + } + ] + } + } } \ No newline at end of file diff --git a/src/components/list-view/index.tsx b/src/components/list-view/index.tsx index 77ab154..ec103c6 100644 --- a/src/components/list-view/index.tsx +++ b/src/components/list-view/index.tsx @@ -24,6 +24,8 @@ class ListView extends Component { if (this.props.lazy) { const { lazyStorage } = this.props; return tools.lazyScrollInit(this.lazyClassName, lazyStorage) + } else { + return undefined } })(); @@ -206,28 +208,33 @@ class ListView extends Component { } }; - updateDampText = act => { + updateDampText = (act: boolean) => { this.needPullDown = act; const { isInit, downLoading } = this.state; const showTip = !downLoading && !isInit; // 展示下拉区域文案 - if (!showTip) return ""; - const { indicator = {}, tipFreedText, tipText } = this.props; - const { - activate = "释放刷新", - deactivate = "下拉刷新" - } = indicator as Indicator; - let text = ""; - if (act) { - text = activate || tipText; - } else { - text = deactivate || tipFreedText; - } - if (Taro.getEnv() === "WEB") { - const target = document.getElementById(this.tipDampTextId) as HTMLElement; - target.innerText = text; + if (!showTip) { + return '' } else { - this.setState({ dampText: text }); + const { indicator = {}, tipFreedText, tipText } = this.props; + const { + activate = "释放刷新", + deactivate = "下拉刷新" + } = indicator as Indicator; + let text = ""; + if (act) { + text = activate || tipText; + } else { + text = deactivate || tipFreedText; + } + if (Taro.getEnv() === "WEB") { + const target = document.getElementById(this.tipDampTextId) as HTMLElement; + target.innerText = text; + } else { + this.setState({ dampText: text }); + } + return undefined } + }; render() { @@ -306,7 +313,7 @@ class ListView extends Component { {/* present children */} - {/*{showChildren && this.props.children}*/} + {showChildren && this.props.children} { - append: Dispatch> + append: any } const screenNum = 7; const screenPage = 3; const moreNum = screenNum * screenPage; -let outSetList: Taro.Dispatch> = () => {}; +let outSetList = () => {}; let updateList: (scrollTop) => void = () => { }; @@ -23,6 +23,7 @@ const UseList = (initData: any[] | (() => any[])): [any[], Methods] => { const append = (newData) => { pureList.current = list.concat(newData).map((i, y) => { return { + // @ts-ignore ...i, __index__: y, bottom: (y + 1) * vr.height, @@ -31,6 +32,7 @@ const UseList = (initData: any[] | (() => any[])): [any[], Methods] => { // setList(newList); setTimeout(() => { if (setHeightRef.current !== null) { + // @ts-ignore setHeightRef.current(pureList.current.length * vr.height + 'px') } }, 300) @@ -55,6 +57,7 @@ const UseList = (initData: any[] | (() => any[])): [any[], Methods] => { cacheList.current = showList }, []); + // @ts-ignore ctx.calcHeight = (setHeight) => { setHeightRef.current = setHeight; } diff --git a/src/components/virtual-list/use-list.ts b/src/components/virtual-list/use-list.ts index f01992e..f138332 100644 --- a/src/components/virtual-list/use-list.ts +++ b/src/components/virtual-list/use-list.ts @@ -1,4 +1,4 @@ -import {useState, useCallback, useEffect, useRef} from '@tarojs/taro'; +import {useState, useCallback, useEffect, useRef} from 'react'; import diff from './diff'; interface UTILS { @@ -28,10 +28,10 @@ interface ListItem { const UseList = (id: string) => { const [renderList, setList] = useState([]);//render in viewpoint - const [isMount, setIsMount] = useState(false);//render in viewpoint + const [, setIsMount] = useState(false);//render in viewpoint const totalHeight = useRef(0);//height of contain const cacheList = useRef([]);//cache all data - const cacheScrollTop = useRef(0); //recode scrollTop of list + // const cacheScrollTop = useRef(0); //recode scrollTop of list const cacheViewPointData = useRef({ beginIndex: 0, endIndex: totalAmount, diff --git a/src/components/virtual-list/v2-list.tsx b/src/components/virtual-list/v2-list.tsx index 5e0f8ce..e4c0b47 100644 --- a/src/components/virtual-list/v2-list.tsx +++ b/src/components/virtual-list/v2-list.tsx @@ -1,4 +1,5 @@ -import Taro, {useState, useEffect } from '@tarojs/taro'; +import React, {useState, useEffect } from 'react'; +import Taro from '@tarojs/taro'; import {View, ScrollView} from '@tarojs/components'; import {utils} from './use-list'; import { throttle } from "../../utils/utils"; @@ -45,7 +46,7 @@ const VirList: Taro.FunctionComponent= (props) => { onScrollToLower={handleLower} > - {this.props.children} + {props.children} ) diff --git a/src/pages/index/index.tsx b/src/pages/index/index.tsx index 0036d0e..2a4c670 100644 --- a/src/pages/index/index.tsx +++ b/src/pages/index/index.tsx @@ -85,7 +85,7 @@ export default class Index extends Component { customizeLoading lazyStorage='listView' > - {list.map((item, index) => { + {list.map((item: any, index) => { return ( @@ -121,7 +121,7 @@ export default class Index extends Component { customizeLoading lazyStorage='listView' > - {list.map((item, index) => { + {list.map((item: any, index) => { return ( diff --git a/src/pages/index/lazy.tsx b/src/pages/index/lazy.tsx index 6d62a30..ff61c56 100644 --- a/src/pages/index/lazy.tsx +++ b/src/pages/index/lazy.tsx @@ -49,7 +49,7 @@ export default class Index extends Component { onScrollToLower={this.onScrollToLower} lazyStorage='listViewLazy' > - {list.map((item, index) => { + {list.map((item: any, index) => { return ( diff --git a/src/style/index.scss b/src/style/index.scss index db70833..152336f 100644 --- a/src/style/index.scss +++ b/src/style/index.scss @@ -1,6 +1,6 @@ -@import './components/list-view/index.scss' -@import './components/list-view/block.scss' -@import './components/loading/index.scss' -@import './components/result-page/index.scss' -@import './components/skeleton/index.scss' +@import './components/list-view/index.scss'; +@import './components/list-view/block.scss'; +@import './components/loading/index.scss'; +@import './components/result-page/index.scss'; +@import './components/skeleton/index.scss'; diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 7311453..0000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,28 +0,0 @@ - { - "compilerOptions": { - "allowSyntheticDefaultImports": true, - "experimentalDecorators": true, - "jsx": "react", - "jsxFactory": "React.createElement", - "moduleResolution": "node", - "noImplicitAny": false, - "noUnusedLocals": true, - "noUnusedParameters": true, - "preserveConstEnums": true, - "skipLibCheck": true, - "sourceMap": true, - "strictNullChecks": true, - "resolveJsonModule": true, - "target": "es2017", - "module": "es6", - "outDir": "./lib" - }, - "compileOnSave": false, - "exclude": [ - "node_modules/*", - ], - - "include": [ - "src/**/*" - ] -} diff --git a/tsconfig.json b/tsconfig.json index e689645..a4f5e98 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -26,6 +26,6 @@ }, "noImplicitAny": false }, - "include": ["./src"], - "exclude": ["node_modules", "scripts", "webpack", "jest"] + "include": ["src/**/*"], + "exclude": ["node_modules/*", "scripts", "webpack", "jest"] } diff --git a/tsconfig.rollup.json b/tsconfig.rollup.json deleted file mode 100644 index 9b1aca5..0000000 --- a/tsconfig.rollup.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "compilerOptions": { - "allowSyntheticDefaultImports": true, - "experimentalDecorators": true, - "jsx": "react", - "jsxFactory": "React.createElement", - "moduleResolution": "node", - "noImplicitAny": false, - "noUnusedLocals": true, - "noUnusedParameters": true, - "preserveConstEnums": true, - "skipLibCheck": true, - "sourceMap": true, - "strictNullChecks": true, - "resolveJsonModule": true, - "target": "es5", - "module": "es6", - "downlevelIteration": true, - "baseUrl": ".", - "types": [ - "node" - ] - }, - "compileOnSave": false, - "exclude": [ - "node_modules/*", - "packages/dist/*" - ], - "include": [ - "src/**/*" - ] -}