{"id":4710,"url":"https://github.com/magicismight/react-native-lazyload","last_synced_at":"2025-08-04T02:31:30.336Z","repository":{"id":41186762,"uuid":"51826508","full_name":"magicismight/react-native-lazyload","owner":"magicismight","description":"lazyload for react native","archived":true,"fork":false,"pushed_at":"2019-10-08T04:44:19.000Z","size":246,"stargazers_count":413,"open_issues_count":26,"forks_count":108,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-04-26T04:36:43.679Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/magicismight.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-16T10:10:13.000Z","updated_at":"2024-04-21T12:54:52.000Z","dependencies_parsed_at":"2022-09-11T12:22:05.225Z","dependency_job_id":null,"html_url":"https://github.com/magicismight/react-native-lazyload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicismight%2Freact-native-lazyload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicismight%2Freact-native-lazyload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicismight%2Freact-native-lazyload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/magicismight%2Freact-native-lazyload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/magicismight","download_url":"https://codeload.github.com/magicismight/react-native-lazyload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228587347,"owners_count":17941442,"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":[],"created_at":"2024-01-05T20:17:20.976Z","updated_at":"2024-12-07T09:30:55.256Z","avatar_url":"https://github.com/magicismight.png","language":"JavaScript","funding_links":[],"categories":["Components"],"sub_categories":["Backend"],"readme":"### react-native-lazyload\n\n------------------------\n\nA \\`lazyload\\` components suit for React Native.\n\n#### Install\n\n```\nnpm install react-native-lazyload\n```\n\n#### Components\n\nComponent           | Description\n------------------- | --------------------\nLazyloadScrollView  | A lazyload container component based on `ScrollView`\nLazyloadListView    | A lazyload container component based on `ListView`\nLazyloadView        | Based on View component. This component\\`s content won\\`t be rendered util it scrolls into sight. It should be inside a `LazyloadScrollView` or `LazyloadListView` which has the same `name` prop as this component\\`s host prop.\nLazyloadImage       | Based on Image component. The image content won\\`t be rendered util it scrolls into sight. It should be inside a `LazyloadScrollView` or `LazyloadListView` which has the same `name` prop as this component\\`s host prop.\n\n#### Usage\n\n##### LazyloadScrollView\n\n1. Using `LazyloadScrollView` instead of `ScrollView`, and specify a unique id for `name` prop.\n2. Layout the views or images which will be lazyloaded by using `LazyloadView` and `LazyloadImage` instead of `View` or `Image`.\n3. Specify `host` prop for every `LazyloadView` and `LazyloadImage`, the `host` prop should be same as outer `LazyloadScrollView` component`s name prop.\n\n```js\nimport React, {\n    Component\n} from 'react-native';\n\nimport {\n    LazyloadScrollView,\n    LazyloadView,\n    LazyloadImage\n} from 'react-native-lazyload';\n\nconst list = [...list data here]; // many rows\n\nclass LazyloadScrollViewExample extends Component{\n    render() {\n        return (\n            \u003cLazyloadScrollView\n                style={styles.container}\n                contentContainerStyle={styles.content}\n                name=\"lazyload-list\"\n            \u003e\n                {list.map((file, i) =\u003e \u003cView\n                    key={i}\n                    style={styles.view}\n                \u003e\n                    \u003cLazyloadView\n                        host=\"lazyload-list\"\n                        style={styles.file}\n                    \u003e\n                        \u003cView style={styles.id}\u003e\n                            \u003cText style={styles.idText}\u003e{file.id}\u003c/Text\u003e\n                        \u003c/View\u003e\n                        \u003cView style={styles.detail}\u003e\n                            \u003cText style={styles.name}\u003e{file.first_name} {file.last_name}\u003c/Text\u003e\n                            \u003cText\u003e\u003cText style={styles.title}\u003eemail: \u003c/Text\u003e\u003cText style={styles.email}\u003e{file.email}\u003c/Text\u003e\u003c/Text\u003e\n                            \u003cText style={styles.ip}\u003e\u003cText style={styles.title}\u003elast visit ip: \u003c/Text\u003e{file.ip_address}\u003c/Text\u003e\n                        \u003c/View\u003e\n                    \u003c/LazyloadView\u003e\n                    \u003cView style={styles.avatar}\u003e\n                        \u003cLazyloadImage\n                            host=\"lazyload-list\"\n                            style={styles.avatarImage}\n                            source={file.avatar}\n                        /\u003e\n                    \u003c/View\u003e\n                \u003c/View\u003e)}\n            \u003c/LazyloadScrollView\u003e\n        );\n    }\n}\n\n```\n\n##### LazyloadListView\n\nSame as ListView. But it won\\`t  render `LazyloadView` and `LazyloadImage` inside it, util they are scrolled into sight.\n\n### Additional Methods\n\n*refresh* - Force to trigger an update.  Useful after nagivation pop/push where the memory may have been release.\n\n### Additional Props\n\nComponents that extend LazyloadView can accept a prop (function) to be called when the item's visibility changes.\n\n*onVisibilityChange* - An optional function to be called with the new visibility, ref, and props\n\nExample:\n\n```\n\n\u003cLazyloadView onVisibilityChange={ this.handleItemVisibility }\u003e\n...\n\u003c/LazyloadView\u003e\n\n...\n\nhandleItemVisibility(visibility, ref, props) {\n    console.log('visibility, ref, props', visibility, ref, props);\n}\n\n```\n#### Run Example\n\nClone this repository from Github and cd to 'Example' directory then run `npm install`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicismight%2Freact-native-lazyload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmagicismight%2Freact-native-lazyload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmagicismight%2Freact-native-lazyload/lists"}