
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-native-autocomplete-input
Advanced tools
Pure javascript autocomplete input for react-native
This is a pure javascript react-native component to display autocomplete suggestions given an array of objects respective to the input text.
Tested with RN >= 0.26.2. If you want to use RN < 0.26 try to install react-native-autocomplete-input <= 0.0.5.
First things first install the component from npmjs.org:
$ npm install --save react-native-autocomplete-input
or install HEAD from github.com:
$ npm install --save l-urence/react-native-autocomplete-input
This brief example should illustrate the usage of the autocomplete:
// ...
render() {
const { query } = this.state;
const data = this._filterData(query)
<Autocomplete
data={data}
defaultValue={query}
onChangeText={text => this.setState({query: text})}
renderItem={data => (
<TouchableOpacity onPress={() =>
this.setState({query: data})
}
>
<Text>{data}</Text>
</TouchableOpacity>
)}
/>
}
// ...
The full example for Android and iOS from the screenshot can be found here.
Android and iOS have different layout systems, because of that it is not possible to use overflows on Android (see #20). For that reason it is necessary to wrap the autocomplete into a separate component on Android and align it absolute to your content, to allow the suggestion list to overlap the other content.
//...
render() {
return(
<View>
<View style={autocompleteContainer}>
<Autocomplete {/* your props */} />
</View>
<Text>Some content</Text>
<View>
);
}
//...
const style = StyleSheet.create({
autocompleteContainer: {
flex: 1,
left: 0,
position: 'absolute',
right: 0,
top: 0,
zIndex: 1
}
});
Prop | Type | Description |
---|---|---|
containerStyle | style | These styles will be applied to the container which surrounds the autocomplete component. |
inputContainerStyle | style | These styles will be applied to the container which surrounds the textInput component. |
style | style | These styles will be applied to the textInput component. |
data | array | Assign an array of data objects which should be rendered in respect to the entered text. |
listStyle | style | These style will be applied to the result list view. |
renderItem | function | renderItem will be called to render the data objects which will be displayed in the result view below the text input. |
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. |
onShowResult | function | onShowResult will be called when the autocomplete suggestions appear or disappear. |
renderTextInput | function | render custom TextInput. All props passed to this function. |
Feel free to open issues or do a PR!
FAQs
Pure javascript autocomplete input for react-native
The npm package react-native-autocomplete-input receives a total of 14,778 weekly downloads. As such, react-native-autocomplete-input popularity was classified as popular.
We found that react-native-autocomplete-input demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.