All Projects → mrlaessig → React Native Autocomplete Input

mrlaessig / React Native Autocomplete Input

Licence: mit
Pure javascript autocomplete input for react-native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Autocomplete Input

Core Components
Accessible and lightweight Javascript components
Stars: ✭ 85 (-86.18%)
Mutual labels:  autocomplete, input
V Suggest
A Vue2 plugin for input content suggestions, support using keyboard to navigate and quick pick, it make use experience like search engine input element
Stars: ✭ 67 (-89.11%)
Mutual labels:  autocomplete, input
Autocompletefield
Subclass of UITextField that shows inline suggestions while typing.
Stars: ✭ 656 (+6.67%)
Mutual labels:  autocomplete, input
paper-chip
A chip web component made with Polymer 2 following Material Design guidelines
Stars: ✭ 30 (-95.12%)
Mutual labels:  autocomplete, input
React Selectrix
A beautiful, materialized and flexible React Select control
Stars: ✭ 166 (-73.01%)
Mutual labels:  autocomplete, input
React Input Enhancements
Set of enhancements for input control
Stars: ✭ 1,375 (+123.58%)
Mutual labels:  autocomplete, input
React Input Tags
React component for tagging inputs.
Stars: ✭ 10 (-98.37%)
Mutual labels:  autocomplete, input
Vue Places
Places component is based on places.js for Vue 2.x. Turn any <input> into an address autocomplete.
Stars: ✭ 106 (-82.76%)
Mutual labels:  autocomplete, input
Vue Cool Select
Select with autocomplete, slots, bootstrap and material design themes.
Stars: ✭ 195 (-68.29%)
Mutual labels:  autocomplete, input
react-native-element-textinput
A react-native TextInput, TagsInput and AutoComplete component easy to customize for both iOS and Android.
Stars: ✭ 28 (-95.45%)
Mutual labels:  autocomplete, input
Accessible Autocomplete
An autocomplete component, built to be accessible.
Stars: ✭ 474 (-22.93%)
Mutual labels:  autocomplete
Vue Autosuggest
🔍 Vue autosuggest component.
Stars: ✭ 492 (-20%)
Mutual labels:  autocomplete
Vue Img Inputer
🏞 A graceful image type inputer / uploader
Stars: ✭ 548 (-10.89%)
Mutual labels:  input
Hue
Open source SQL Query Assistant service for Databases/Warehouses
Stars: ✭ 351 (-42.93%)
Mutual labels:  autocomplete
Bunny
BunnyJS - Lightweight native (vanilla) JavaScript (JS) and ECMAScript 6 (ES6) browser library, package of small stand-alone components without dependencies: FormData, upload, image preview, HTML5 validation, Autocomplete, Dropdown, Calendar, Datepicker, Ajax, Datatable, Pagination, URL, Template engine, Element positioning, smooth scrolling, routing, inversion of control and more. Simple syntax and architecture. Next generation jQuery and front-end framework. Documentation and examples available.
Stars: ✭ 473 (-23.09%)
Mutual labels:  autocomplete
Nouislider
noUiSlider is a lightweight, ARIA-accessible JavaScript range slider with multi-touch and keyboard support. It is fully GPU animated: no reflows, so it is fast; even on older devices. It also fits wonderfully in responsive designs and has no dependencies.
Stars: ✭ 5,127 (+733.66%)
Mutual labels:  input
Vue Google Autocomplete
A Vue.js autosuggest component for the Google Places API.
Stars: ✭ 467 (-24.07%)
Mutual labels:  autocomplete
React Phone Input 2
📞 Highly customizable phone input component with auto formatting
Stars: ✭ 446 (-27.48%)
Mutual labels:  input
Vue Tel Input
International Telephone Input with Vue https://educationlink.github.io/vue-tel-input/
Stars: ✭ 443 (-27.97%)
Mutual labels:  input
Autocomplete
Autocomplete for terminals on MacOS
Stars: ✭ 569 (-7.48%)
Mutual labels:  autocomplete

react-native-autocomplete-input

npm version Build Status

A pure JS autocomplete component for React Native. Use this component in your own projects or use it as inspiration to build your own autocomplete.

Autocomplete Example

How to use react-native-autocomplete-input

Tested with RN >= 0.26.2. If you want to use RN < 0.26 try to install react-native-autocomplete-input <= 0.0.5.

Installation

$ npm install --save react-native-autocomplete-input

or install HEAD from github.com:

$ npm install --save mrlaessig/react-native-autocomplete-input

Example

// ...

render() {
  const { query } = this.state;
  const data = this._filterData(query);
  return (
    <Autocomplete
      data={data}
      defaultValue={query}
      onChangeText={text => this.setState({ query: text })}
      renderItem={({ item, i }) => (
        <TouchableOpacity onPress={() => this.setState({ query: item })}>
          <Text>{item}</Text>
        </TouchableOpacity>
      )}
    />
  );
}

// ...

A complete example for Android and iOS can be found here.

Android

Android does not support overflows (#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.

//...

render() {
  return(
    <View>
      <View style={styles.autocompleteContainer}>
        <Autocomplete {/* your props */} />
      </View>
      <View>
        <Text>Some content</Text>
      </View>
    </View>
  );
}

//...

const styles = StyleSheet.create({
  autocompleteContainer: {
    flex: 1,
    left: 0,
    position: 'absolute',
    right: 0,
    top: 0,
    zIndex: 1
  }
});

Props

Prop Type Description
containerStyle style These styles will be applied to the container which surrounds the autocomplete component.
hideResults bool Set to true to hide the suggestion list.
data array An array with suggestion items to be rendered in renderItem({ item, i }). Any array with length > 0 will open the suggestion list and any array with length < 1 will hide the list.
inputContainerStyle style These styles will be applied to the container which surrounds the textInput component.
listContainerStyle style These styles will be applied to the container which surrounds the result list.
listStyle style These style will be applied to the result list.
onShowResult function onShowResult will be called when the autocomplete suggestions appear or disappear.
onStartShouldSetResponderCapture function onStartShouldSetResponderCapture will be passed to the result list view container (onStartShouldSetResponderCapture).
renderItem function renderItem will be called to render the data objects which will be displayed in the result view below the text input.
keyExtractor function keyExtractor(item, i) will be called to get key for each item. It's up to you which string to return as a key.
renderSeparator function renderSeparator will be called to render the list separators which will be displayed between the list elements in the result view below the text input.
renderTextInput function render custom TextInput. All props passed to this function.
flatListProps object custom props to FlatList].

Known issues

  • By default the autocomplete will not behave as expected inside a <ScrollView />. Set the scroll view's prop to fix this: keyboardShouldPersistTaps={true} for RN <= 0.39, or keyboardShouldPersistTaps='always' for RN >= 0.40. (#5).
  • If you want to test with Jest add jest.mock('react-native-autocomplete-input', () => 'Autocomplete'); to your test.

Contribute

Feel free to open issues or do a PR!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].