{"id":4032,"url":"https://github.com/byteburgers/react-native-autocomplete-input","last_synced_at":"2025-05-13T23:08:44.090Z","repository":{"id":38291996,"uuid":"52279702","full_name":"byteburgers/react-native-autocomplete-input","owner":"byteburgers","description":"Pure javascript autocomplete input for react-native","archived":false,"fork":false,"pushed_at":"2024-10-28T22:28:48.000Z","size":2845,"stargazers_count":816,"open_issues_count":12,"forks_count":255,"subscribers_count":15,"default_branch":"main","last_synced_at":"2024-10-29T13:49:47.265Z","etag":null,"topics":["android","autocomplete","input","ios","javascript","react-native","typescript"],"latest_commit_sha":null,"homepage":"https://byteburgers.com/autocomplete","language":"TypeScript","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/byteburgers.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":"2016-02-22T14:38:28.000Z","updated_at":"2024-10-26T07:39:16.000Z","dependencies_parsed_at":"2023-10-16T12:56:52.984Z","dependency_job_id":"f39755ff-00d6-41e9-ae1e-8ba712cc9163","html_url":"https://github.com/byteburgers/react-native-autocomplete-input","commit_stats":null,"previous_names":["mrlaessig/react-native-autocomplete-input","l-urence/react-native-autocomplete-input"],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteburgers%2Freact-native-autocomplete-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteburgers%2Freact-native-autocomplete-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteburgers%2Freact-native-autocomplete-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteburgers%2Freact-native-autocomplete-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byteburgers","download_url":"https://codeload.github.com/byteburgers/react-native-autocomplete-input/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154073,"owners_count":21056536,"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":["android","autocomplete","input","ios","javascript","react-native","typescript"],"created_at":"2024-01-05T20:16:59.044Z","updated_at":"2025-04-10T03:38:48.712Z","avatar_url":"https://github.com/byteburgers.png","language":"TypeScript","funding_links":[],"categories":["Components"],"sub_categories":["UI"],"readme":"# react-native-autocomplete-input\n[![npm version](https://badge.fury.io/js/react-native-autocomplete-input.svg)](https://badge.fury.io/js/react-native-autocomplete-input)\n[![Test](https://github.com/mrlaessig/react-native-autocomplete-input/actions/workflows/test.yml/badge.svg)](https://github.com/mrlaessig/react-native-autocomplete-input/actions/workflows/test.yml)\n\nA pure JS autocomplete component for React Native written in TypeScript. Use this component in your own projects or use it as inspiration to build your own autocomplete.\n\n![Autocomplete Example](https://raw.githubusercontent.com/mrlaessig/react-native-autocomplete-input/master/example.gif)\n\nPlay around with the [Example Snack](https://byteburgers.com/autocomplete)\n\n### Installation\n\n```shell\n# Install with npm\n$ npm install --save react-native-autocomplete-input\n\n# Install with yarn\n$ yarn add react-native-autocomplete-input\n```\n\n### Example\n\n```javascript\nfunction MyComponent() {\n  const [ query, setQuery ] = useState('');\n  const data = useFilteredData(query);\n\n  return (\n    \u003cAutocomplete\n      data={data}\n      value={query}\n      onChangeText={(text) =\u003e setQuery(text)}\n      flatListProps={{\n        keyExtractor: (_, idx) =\u003e idx,\n        renderItem: ({ item }) =\u003e \u003cText\u003e{item}\u003c/Text\u003e,\n      }}\n    /\u003e\n  );\n}\n```\n\n### Android\nAndroid does not support overflows ([#20](https://github.com/mrlaessig/react-native-autocomplete-input/issues/20)), for that reason it is necessary to wrap the autocomplete into a *absolute* positioned view on Android. This will  allow the suggestion list to overlap other views inside your component.\n\n```javascript\nfunction MyComponent() {\n  return (\n    \u003cView\u003e\n      \u003cView style={styles.autocompleteContainer}\u003e\n        \u003cAutocomplete {/* your props */} /\u003e\n      \u003c/View\u003e\n      \u003cView\u003e\n        \u003cText\u003eSome content\u003c/Text\u003e\n      \u003c/View\u003e\n    \u003c/View\u003e\n  );\n}\n\nconst styles = StyleSheet.create({\n  autocompleteContainer: {\n    flex: 1,\n    left: 0,\n    position: 'absolute',\n    right: 0,\n    top: 0,\n    zIndex: 1\n  }\n});\n\n```\n\n### Props\n| Prop | Type | Description |\n| :------------ |:---------------:| :-----|\n| containerStyle | style | These styles will be applied to the container which surrounds the autocomplete component. |\n| hideResults | bool | Set to `true` to hide the suggestion list.\n| data | array | An array with suggestion items to be rendered in `renderItem({ item, i })`. Any array with length \u003e 0 will open the suggestion list and any array with length \u003c 1 will hide the list. |\n| inputContainerStyle | style | These styles will be applied to the container which surrounds the textInput component. |\n| listContainerStyle | style | These styles will be applied to the container which surrounds the result list. |\n| listStyle | style | These style will be applied to the result list. |\n| onShowResults | function | `onShowResults` will be called when the autocomplete suggestions appear or disappear. |\n| onStartShouldSetResponderCapture | function | `onStartShouldSetResponderCapture` will be passed to the result list view container ([onStartShouldSetResponderCapture](https://reactnative.dev/docs/gesture-responder-system#capture-shouldset-handlers)). |\n| renderTextInput | function | render custom TextInput. All props passed to this function. |\n| flatListProps | object | custom props to [FlatList](https://reactnative.dev/docs/flatlist). |\n| renderResultList | function | render custom result list. Can be used to replace FlatList. All props passed to this function. |\n\n## Known issues\n* By default the autocomplete will not behave as expected inside a `\u003cScrollView /\u003e`. Set the scroll view's prop to fix this: `keyboardShouldPersistTaps={true}` for RN \u003c= 0.39, or `keyboardShouldPersistTaps='always'` for RN \u003e= 0.40. ([#5](https://github.com/mrlaessig/react-native-autocomplete-input/issues/5)). Alternatively, you can use renderResultList to render a custom result list that does not use FlatList. See the tests for an example.\n* If you want to test with Jest add ```jest.mock('react-native-autocomplete-input', () =\u003e 'Autocomplete');``` to your test.\n\n## Contribute\nFeel free to open issues or submit a PR!\n\n### Local development\n```shell\n# Install Dependencies\n$ npm i\n\n# Locally link the autocomplete package into the example project\n$ npm link react-native-autocomplete-input -w starwarsmoviefinder \n\n# Enable package rebuild on changes\n$ npx nx watch --projects=react-native-autocomplete-input -- npm run build \n\n# Run the example project\n$ npm run start -w starwarsmoviefinder\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteburgers%2Freact-native-autocomplete-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyteburgers%2Freact-native-autocomplete-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteburgers%2Freact-native-autocomplete-input/lists"}