{"id":22663167,"url":"https://github.com/puti94/react-native-autoflatlist","last_synced_at":"2025-07-03T08:05:35.094Z","repository":{"id":57335550,"uuid":"110776626","full_name":"puti94/react-native-autoflatlist","owner":"puti94","description":"一个自动上拉下拉提供分页加载的FlatList组件","archived":false,"fork":false,"pushed_at":"2017-11-30T01:40:23.000Z","size":90,"stargazers_count":30,"open_issues_count":2,"forks_count":4,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-13T11:16:28.725Z","etag":null,"topics":["flatlist","react-native"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puti94.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-15T03:07:09.000Z","updated_at":"2024-01-22T05:57:30.000Z","dependencies_parsed_at":"2022-09-07T16:04:39.975Z","dependency_job_id":null,"html_url":"https://github.com/puti94/react-native-autoflatlist","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/puti94/react-native-autoflatlist","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-autoflatlist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-autoflatlist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-autoflatlist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-autoflatlist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puti94","download_url":"https://codeload.github.com/puti94/react-native-autoflatlist/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puti94%2Freact-native-autoflatlist/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263287832,"owners_count":23443080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flatlist","react-native"],"created_at":"2024-12-09T12:17:34.312Z","updated_at":"2025-07-03T08:05:35.048Z","avatar_url":"https://github.com/puti94.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-autoflatlist\n一个自动上拉下拉提供分页加载的FlatList组件  \n!基于最新版写的，在低版本下可能某些方法有Bug,如0.44.3的FlatList的ListFooterComponent这个方法有问题。注释掉即可（上拉过程的状态显示就没有了）\n\n- 安装:\n   ```\n       npm install react-native-autoflatlist --save\n   ```\n- 使用:\n   ```\n       import AutoFlatList from 'react-native-autoflatlist'\n   ```\n\n\n ```js  \n    /**\n     * 模拟从网络上加载数据\n     * @param page\n     * @returns {Promise}\n     */\n    loadData(page) {\n        return new Promise((resolve, reject) =\u003e {\n            setTimeout(() =\u003e {\n                // reject('发生错误'); //模拟发生错误\n                let data = [];\n                for (let i = 0; i \u003c 10; i++) {\n                    data.push(`页数${page},数据源${i}`)\n                }\n\n                //模拟没有更多数据\n                //data.splice(5, 3)\n\n                resolve(data)\n            }, 1000)\n        })\n    }\n\n    renderItem(item, index) {\n        return \u003cText style={{fontSize: 28, padding: 40, backgroundColor: 'white', marginTop: 1}}\u003e{item}\u003c/Text\u003e\n    }\n\n    render() {\n        return (\n            \u003cAutoFlatList\n                style={{flex: 1, marginTop: 64, backgroundColor: '#eee'}}\n                netWork={(page) =\u003e this.loadData(page)}\n                loadMoreEnable={true}\n                renderItem={({item, index}) =\u003e this.renderItem(item, index)}\n            /\u003e\n        );\n    }\n  ```\n## 示例图\n  ![效果图](https://github.com/puti94/react-native-autoflatlist/blob/master/1.gif)\n\n## Props\n| Prop | Type | Default | Note |\n|---|---|---|---|\n| [FlatList props...](https://facebook.github.io/react-native/docs/FlatList.html) |  |  |  组件继承 FlatList 组件的全部属性。\n| style | 同View.style |  | 组件样式, 也就是组件的容器 View 的样式。\n| refreshEnable | bool | true | 是否能下拉刷新\n| loadMoreEnable | bool | false | 是否能上拉加载\n| netWork | func |  | 数据加载方法,会传一个page,需要回传一个Promise,resolve需要传入一个数组\n| emptyButtonTitle | string | '重新加载' | 空视图按钮的文字\n| emptyOnPress | func |  | 默认提供空视图的按钮点击事件，不传则执行onRefresh方法\n| emptyView | element |  | 覆盖原有的空视图组件\n| noMoreView | element |  | 覆盖原有的没有更多数据的组件\n| loadMoreView | element |  | 覆盖原有的上拉加载组件\n\n## Events\n| Event Name | Returns | Notes |\n|---|---|---|\n| reLoadData |  | 重新加载数据\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Freact-native-autoflatlist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fputi94%2Freact-native-autoflatlist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fputi94%2Freact-native-autoflatlist/lists"}