Giter Site home page Giter Site logo

vizir / react-native-autocomplete-select Goto Github PK

View Code? Open in Web Editor NEW
67.0 5.0 23.0 316 KB

AutoComplete with selection for react-native

License: MIT License

JavaScript 100.00%
react-native autocomplete autocomplete-component auto-complete component

react-native-autocomplete-select's Introduction

react-native-autocomplete-select

alt text

Simple AutoComplete with selection for react-native

Standard - JavaScript Style Guide Build Status Code Climate Test Coverage Issue Count

Install

npm install --save react-native-autocomplete-select

Usage

Simple example:

import AutoComplete from 'react-native-autocomplete-select'

...

const onSelect = (suggestion) => {
  console.log(suggestion) // the pressed suggestion
}

const suggestions = [
  {text: 'suggestion1', anotherProperty: 'value'},
  {text: 'suggestion2', anotherProperty: 'value2'}
]

<AutoComplete
  onSelect={onSelect}
  suggestions={suggestions}
  suggestionObjectTextProperty='text'
  value='sug'
/>

Will output:

alt text

Available Properties Description
suggestions An array of objects or values to use as suggestions
value Current value of the input
minimumSimilarityScore Value from 0 (matches anything) to 1 (only matches if the strings are the same), defaults to 0.6. The input value will be compared to the suggestion, the suggestion score should be greater than or equal to this value to be shown.
comparationFuzziness Value from 0 to 1, defaults to 0.5. This is the fuzziness level used on similarity comparation.
suggestionObjectTextProperty If the suggestions in the array are objects, this will be used to get the suggestion value. The value will be shown on the list and will be used to check the similarity of the suggestion to the input value.
onChangeText Function to execute when the input value changes.
onSelect (Required) Function to call when a suggestion is pressed. Will be called with the suggestion as a parameter
suggestionsWrapperStyle Style of the list of suggestion.
suggestionStyle Style of the suggestion item in the list.
suggestionTextStyle Style of the suggestion text.
style Style of the component.
inputStyle Style of the text input.

Contributing

  1. Fork this repository
  2. Create a branch based on master about what you are doing
  • Names should be separated by hyphen: example-name
  1. Commit using the format: [<type>] <message>
  • The type should be: Feat, Fix, Refactor or Docs
  • Example message: [Docs] Added contributing to readme
  • Do not forget to add tests!
  1. Run all tests npm test and linter npm run lint
  2. Create a pull request describing the changes you made

License

MIT

react-native-autocomplete-select's People

Contributors

apantaliao avatar chagasaway avatar thiagonp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

react-native-autocomplete-select's Issues

Error When starting react-native run-android

Loading dependency graph, done.
Bundling index.js [development, non-minified] 0.0% (0/1), failed.
error: bundling failed: ambiguous resolution: module D:\Google Drive\DivisionbyZero\smsSorter\index.js tries to require react-native, but there are several files providing this module. You can delete or fix them:

  • D:\Google Drive\DivisionbyZero\smsSorter\node_modules\react-native-autocomplete-select\node_modules\react-native\package.json
  • D:\Google Drive\DivisionbyZero\smsSorter\node_modules\react-native\package.json

undefined is not an object ( evaluatin g'_react3.default.PropTypes.array')

image

Heres my package

{
"main": "node_modules/expo/AppEntry.js",
"private": true,
"scripts": {
"test": "node ./node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/samples": "2.1.1",
"expo": "^24.0.0",
"react": "16.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz",
"react-native-autocomplete-select": "^1.0.0",
"react-navigation": "^1.0.0-beta.21"
},
"devDependencies": {
"jest-expo": "^24.0.0"
}
}

Does not work on react 16

The text input stutters with the input value thats always there, you cannot type or clear the input value, no searches are returned.

Making it work the hacky way

First of all #4:
A bunch of these

This warning is caused by a @providesModule declaration with the same name across two different files.
Loading dependency graph, done.
warning: the transform cache was reset.

Unable to resolve module `AccessibilityInfo` from `./node_modules/react-native/Libraries/react-native/react-native-implementation.js`: Module does not exist in the module map

Fixed by deleting the react-native folder inside the module #4 (comment)
rm -r ./node_modules/react-native-autocomplete-select/node_modules/react-native

After that you might get:

FAILURE: Build failed with an exception.

* What went wrong:
Could not list contents of './node_modules/react-native-autocomplete-select/node_modules/.bin/react-native'.

You also need to delete that file
rm ./node_modules/react-native-autocomplete-select/node_modules/.bin/react-native

Also apply 9194061 but don't forget to add prop-types to package.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.