react-native-autocomplete-input
Advanced tools
Comparing version 3.2.1 to 3.3.0
32
index.js
@@ -20,6 +20,2 @@ import React, { Component, PropTypes } from 'react'; | ||
/** | ||
* Set to `true` to hide the suggestion list. | ||
*/ | ||
hideResults: PropTypes.bool, | ||
/** | ||
* Assign an array of data objects which should be | ||
@@ -29,2 +25,6 @@ * rendered in respect to the entered text. | ||
data: PropTypes.array, | ||
/** | ||
* Set to `true` to hide the suggestion list. | ||
*/ | ||
hideResults: PropTypes.bool, | ||
/* | ||
@@ -36,2 +36,6 @@ * These styles will be applied to the container which surrounds | ||
/* | ||
* Set `keyboardShouldPersistTaps` to true if RN version is <= 0.39. | ||
*/ | ||
keyboardShouldPersistTaps: View.propTypes.keyboardShouldPersistTaps, | ||
/* | ||
* These styles will be applied to the container which surrounds | ||
@@ -51,2 +55,6 @@ * the result list. | ||
/** | ||
* method for intercepting swipe on ListView. Used for ScrollView support on Android | ||
*/ | ||
onStartShouldSetResponderCapture: PropTypes.func, | ||
/** | ||
* `renderItem` will be called to render the data objects | ||
@@ -72,2 +80,4 @@ * which will be displayed in the result view below the | ||
defaultValue: '', | ||
keyboardShouldPersistTaps: 'always', | ||
onStartShouldSetResponderCapture: () => false, | ||
renderItem: rowData => <Text>{rowData}</Text>, | ||
@@ -83,2 +93,3 @@ renderSeparator: null, | ||
this.state = { dataSource: ds.cloneWithRows(props.data) }; | ||
this.resultList = null; | ||
} | ||
@@ -109,8 +120,9 @@ | ||
const { dataSource } = this.state; | ||
const { listStyle, renderItem, renderSeparator } = this.props; | ||
const { listStyle, renderItem, renderSeparator, keyboardShouldPersistTaps } = this.props; | ||
return ( | ||
<ListView | ||
ref={(resultList) => { this.resultList = resultList; }} | ||
dataSource={dataSource} | ||
keyboardShouldPersistTaps="always" | ||
keyboardShouldPersistTaps={keyboardShouldPersistTaps} | ||
renderRow={renderItem} | ||
@@ -142,3 +154,4 @@ renderSeparator={renderSeparator} | ||
listContainerStyle, | ||
onShowResults | ||
onShowResults, | ||
onStartShouldSetResponderCapture | ||
} = this.props; | ||
@@ -156,3 +169,6 @@ const showResults = dataSource.getRowCount() > 0; | ||
{!hideResults && ( | ||
<View style={listContainerStyle}> | ||
<View | ||
style={listContainerStyle} | ||
onStartShouldSetResponderCapture={onStartShouldSetResponderCapture} | ||
> | ||
{showResults && this.renderResultList()} | ||
@@ -159,0 +175,0 @@ </View> |
{ | ||
"name": "react-native-autocomplete-input", | ||
"version": "3.2.1", | ||
"version": "3.3.0", | ||
"description": "Pure javascript autocomplete input for react-native", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -93,2 +93,3 @@ # react-native-autocomplete-input | ||
| 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](https://facebook.github.io/react-native/docs/gesture-responder-system.html#capture-shouldset-handlers)). | | ||
| renderItem | function | `renderItem` will be called to render the data objects which will be displayed in the result view below the text input. | | ||
@@ -99,3 +100,3 @@ | 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. | | ||
## Known issues | ||
* By default the autocomplete will not behave as expected inside a `<ScrollView />`. Set the scroll view's prop `keyboardShouldPersistTaps={true}` to fix this ([#5](https://github.com/l-urence/react-native-autocomplete-input/issues/5)). | ||
* 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](https://github.com/l-urence/react-native-autocomplete-input/issues/5)). | ||
* If you want to test with Jest add ```jest.mock('react-native-autocomplete-input', () => 'Autocomplete');``` to your test. | ||
@@ -102,0 +103,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12710
211
104