{"id":23072392,"url":"https://github.com/fattahmuhyiddeen/react-native-complete-flatlist","last_synced_at":"2025-07-06T07:05:01.799Z","repository":{"id":38751993,"uuid":"120260400","full_name":"fattahmuhyiddeen/react-native-complete-flatlist","owner":"fattahmuhyiddeen","description":"Extension of React Native FlatList, but pre built in with many usefull fetures like pull to refresh, search, animation and others","archived":false,"fork":false,"pushed_at":"2024-11-30T15:32:37.000Z","size":95,"stargazers_count":64,"open_issues_count":0,"forks_count":16,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T13:08:55.341Z","etag":null,"topics":["flatlist","highlight","pull-to-refresh","react-native","search"],"latest_commit_sha":null,"homepage":"","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/fattahmuhyiddeen.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-05T05:45:43.000Z","updated_at":"2024-11-30T15:32:40.000Z","dependencies_parsed_at":"2024-06-12T16:54:31.032Z","dependency_job_id":"50a01045-6e15-4351-b42b-3e3cf36d8939","html_url":"https://github.com/fattahmuhyiddeen/react-native-complete-flatlist","commit_stats":{"total_commits":86,"total_committers":5,"mean_commits":17.2,"dds":0.09302325581395354,"last_synced_commit":"4a19356633cc43a1abbd2923d8a7441255c483c2"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahmuhyiddeen%2Freact-native-complete-flatlist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahmuhyiddeen%2Freact-native-complete-flatlist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahmuhyiddeen%2Freact-native-complete-flatlist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fattahmuhyiddeen%2Freact-native-complete-flatlist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fattahmuhyiddeen","download_url":"https://codeload.github.com/fattahmuhyiddeen/react-native-complete-flatlist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247345850,"owners_count":20924102,"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","highlight","pull-to-refresh","react-native","search"],"created_at":"2024-12-16T07:19:42.554Z","updated_at":"2025-04-05T14:05:00.664Z","avatar_url":"https://github.com/fattahmuhyiddeen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# react-native-complete-flatlist\n\nExtended version of react native flat list with many built in function such as search, pull to refresh, no data available message if empty row\n\n![ezgif-3-734272a58f](https://user-images.githubusercontent.com/24792201/35842001-724e51be-0b3a-11e8-8a4b-77eb8b4ed17f.gif)\n\nCaution:\n\n`renderItem` props return `item` and `index` parameters\n`item` parameter returns a single element in `item` array. But if search text is not empty dan `highlightColor` props is set to any color, `item` parameter will return new structure of JSON object (in order to render highlighted text in jsx). This might break your logic. Therefore, if you want to access original structure of your data, it will be under `item.cleanData`. Remember, `item.cleanData` only exist if `highlightColor` props and search textfield is not empty (user is searching)\n\nUsage :\n\n```\nimport React, {useRef} from 'react';\nimport { Text, SafeAreaView, TouchableOpacity } from 'react-native';\nimport CompleteFlatList from 'react-native-complete-flatlist';\n\nconst list = [\n  { name: 'Fattah', status: 'Active', time: '8:10 PM', date: '1 Jan 2018' },\n  { name: 'Syah', status: 'Active', time: '9:14 PM', date: '1 Dec 2018' },\n  { name: 'Izzat', status: 'Active', time: '8:15 PM', date: '1 Jan 2018' },\n  { name: 'Ali', status: 'Active', time: '8:10 PM', date: '1 Jan 2018' },\n  { name: 'Abu', status: 'Active', time: '8:11 PM', date: '1 Jan 2018' },\n  { name: 'Fitri', status: 'Active', time: '8:20 PM', date: '1 Jan 2018' },\n  { name: 'Armi', status: 'Active', time: '8:33 PM', date: '1 Jan 2018' },\n  { name: 'Eidit', status: 'Active', time: '9:10 PM', date: '1 Jan 2018' },\n  { name: 'Hamdan', status: 'Active', time: '10:10 PM', date: '1 Jan 2018' },\n  {\n    name: 'Muhyiddeen',\n    status: 'Blocked',\n    time: '10:10 PM',\n    date: '9 Feb 2018',\n  },\n];\n\nconst App = () =\u003e {\n  const ref = useRef();\n  const renderItem = ({item, index}) =\u003e {\n    const data = item.cleanData ? item.cleanData : item;\n\n    console.log('item (if search bar is not empty and prop highlightColor is not empty, item will contains extra data to enable highlight feature)', item);\n    console.log('cleanData (if search bar is not empty and prop highlightColor is not empty, cleanData will contain original data structure without extra data)', item.cleanData);\n\n\n    console.log('this is index number : ' + index);\n\n    console.log(data + ' this is original data');\n\n    return \u003cText\u003e{item.name}\u003c/Text\u003e;\n  };\n\n  return (\n    \u003cSafeAreaView style={{ flex: 1 }}\u003e\n      \u003cCompleteFlatList\n        searchKey={['name', 'status', 'time', 'date']}\n        pullToRefreshCallback={() =\u003e console.log('refreshing')}\n        data={list}\n        // renderSeparator={null}\n        ref={ref}\n        highlightColor=\"yellow\"\n        renderItem={renderItem}\n      /\u003e\n      \u003cTouchableOpacity onPress={() =\u003e ref.current.clearSearch()} style={{ padding: 5 }}\u003e\n        \u003cText\u003eClear Search\u003c/Text\u003e\n      \u003c/TouchableOpacity\u003e\n    \u003c/SafeAreaView\u003e\n  );\n};\n\nexport default App;\n\n\n\n```\n\n### Upgrading from V 1.x.x to V 2.x.x\n\nChange from `renderItem={(data, index) =\u003e {} }` to `renderItem={({item, index, separators}) =\u003e {} }` (similar like the on in Original Flatlist)\n\n### Properties\n\nAll FlatList props should work plus props mentioned below\n\n| Prop                          | Type                                                                                                 | Description                                                                                                                                                                                                                                                                                                               | Default                                                             | Required                                                                |\n| ----------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- | ----------------------------------------------------------------------- |\n| `showSearch`                  | boolean                                                                                              | If `true` (and `searchKey` prop is defined), search bar will be shown.                                                                                                                                                                                                                                                    | true                                                                | Optional                                                                |\n| `isJelly`                     | boolean                                                                                              | If `true`, when user scroll, the list will expand a lil bit, and when user stop drag, the list will back to original size (iMessage on iPhone style)                                                                                                                                                                      | false                                                               | Optional                                                                |\n| `slide`                       | string                                                                                               | Animation how every items come into the list. Can be \"none\", \"left\" or \"right\"                                                                                                                                                                                                                                            | `none`                                                              | Optional                                                                |\n| `data`                        | array of objects                                                                                     | Data to be rendered in the list                                                                                                                                                                                                                                                                                           | []                                                                  | Required (come on, ofcourse u need data for this)                       |\n| `backgroundStyles`            | style object                                                                                         | Style of the flatlist background                                                                                                                                                                                                                                                                                          | null                                                                | Optional                                                                |\n| `searchBarBackgroundStyles`   | style object                                                                                         | Style of the searchbar background                                                                                                                                                                                                                                                                                         | null                                                                | Optional                                                                |\n| `pullToRefreshCallback`       | function                                                                                             | Callback function when user pull to refresh                                                                                                                                                                                                                                                                               | null                                                                | Optional (Pull to refresh will not be available if this is not supplied |\n| `isLoading`                   | boolean                                                                                              | if true, the loading will be shown on top of the list.                                                                                                                                                                                                                                                                    | false                                                               | Optional                                                                |\n| `renderItem`                  | function that return a JSX element (Just like RN's ListView and FlatList)                            | Template of a row in the Flat List                                                                                                                                                                                                                                                                                        | null (open for PR if anyone wish to make default template for this) | Required (since I dont do default template yet)                         |\n| `renderSeparator`             | function that return a JSX element to be rendered between rows(Just like RN's ListView and FlatList) | Template of separator in the Flat List                                                                                                                                                                                                                                                                                    | `() =\u003e \u003cView style={{ height: 1, width: \"80%\", alignSelf: \"center\", backgroundColor: \"#f2f2f2\" }} /\u003e`                                                    | Optional                                                                |\n| `placeholder`                 | string                                                                                               | Placeholder of search field                                                                                                                                                                                                                                                                                               | \"Search ...\"                                                        | Optional                                                                |\n| `searchTextInputStyle`        | object (style for React Native's TextInput component)                                                | style for search field                                                                                                                                                                                                                                                                                                    | null                                                                | Optional                                                                |\n| `highlightColor`              | color                                                                                                | color of higlighted words background when match search keyword. Please read the pre caution if using this prop on top of the readme                                                                                                                                                                                       | yellow                                                              | Optional                                                                |\n| `searchKey`                   | array of string                                                                                      | This should be name of keys available in data which will be use to search. If this prop is not supplied, search text input will not be rendered. `**Warning: nested key not yet supported`                                                                                                                                | []                                                                | Optional (if not supplied, search field will not appear)                |\n| `elementBetweenSearchAndList` | JSX element                                                                                          | What to render between searchbar and the list                                                                                                                                                                                                                                                                             | null                                                                | Optional                                                                |\n| `refreshOnLoad`               | boolean                                                                                              | If `true`, prop `pullToRefreshCallback` will be called if available                                                                                                                                                                                                                                                       | true                                                                | Optional                                                                |\n| `onSearch`                    | function that will replace `pullToRefreshCallback`                                                   | If exist, `pullToRefreshCallback` will be overrided. This will not triggered on key press, but on return key pressed. This props is introduced if search trigger result from API. If you just want local search (search from existing array), this props is not needed. `onSearch` will automatic get `keyword` parameter | ()=\u003enull                                                            | Optional  \n| `loadNext`                    | function | If defined, this function will be called when user scroll FlatList to the bottom. The usecase is to call next pagination of your API. If defined, loading icon will be shown at the bottom of the list. To hide the loading icon, make sure this prop is undefined | undefined | Optional                                                                |\n| `refreshControlProps`                    | object | props for RefreshControl | undefined | Optional                                                                |\n\n### Methods\n\nIf you have `ref` to the component,\n```\nconst completeFlatList = useRef();\n...\n \u003cCompleteFlatList\n   ...\n    ref={completeFlatList}\n   ...\n /\u003e\n\n```\n\nor in component based\n\n```\n\n\u003cCompleteFlatList\n   ...\n   ref={c =\u003e this.completeFlatList = c}\n   ...\n/\u003e\n```\n\nyou can use any method(s) below:\n```completeFlatList.current.methodName()```\n\nor in component based\n\n```this.completeFlatList.methodName()```\n\n| Method      | Description                         |\n| ----------- | ----------------------------------- |\n| clearSearch | Clear search input programmatically |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffattahmuhyiddeen%2Freact-native-complete-flatlist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffattahmuhyiddeen%2Freact-native-complete-flatlist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffattahmuhyiddeen%2Freact-native-complete-flatlist/lists"}