Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-autocomplete-input

Package Overview
Dependencies
Maintainers
0
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-autocomplete-input - npm Package Compare versions

Comparing version 5.5.1 to 5.5.2

14

dist/index.d.ts
import React from 'react';
import type { FlatListProps, TextInputProps, StyleProp, ViewStyle } from 'react-native';
export type AutocompleteInputProps<T> = TextInputProps & {
export type AutocompleteInputProps<Item> = TextInputProps & {
containerStyle?: StyleProp<ViewStyle>;

@@ -9,6 +9,6 @@ hideResults?: boolean;

onShowResults?: (showResults: boolean) => void;
renderResultList?: (props: FlatListProps<T>) => React.ReactElement;
renderTextInput?: (props: TextInputProps) => React.ReactElement;
flatListProps?: Partial<Omit<FlatListProps<T>, 'data'>>;
data: readonly T[];
renderResultList?: React.FC<FlatListProps<Item>>;
renderTextInput?: React.FC<TextInputProps>;
flatListProps?: Partial<Omit<FlatListProps<Item>, 'data'>>;
data: readonly Item[];
};

@@ -21,4 +21,4 @@ export declare const AutocompleteInput: React.ForwardRefExoticComponent<TextInputProps & {

onShowResults?: (showResults: boolean) => void;
renderResultList?: ((props: FlatListProps<unknown>) => React.ReactElement) | undefined;
renderTextInput?: (props: TextInputProps) => React.ReactElement;
renderResultList?: React.FC<FlatListProps<unknown>> | undefined;
renderTextInput?: React.FC<TextInputProps>;
flatListProps?: Partial<Omit<FlatListProps<unknown>, "data">> | undefined;

@@ -25,0 +25,0 @@ data: readonly unknown[];

@@ -8,15 +8,11 @@ import React from 'react';

}
function DefaultResultList(props) {
return <FlatList {...props}/>;
function defaultRenderItem({ item }) {
return <Text>{String(item)}</Text>;
}
function DefaultTextInput(props) {
return <TextInput {...props}/>;
}
export const AutocompleteInput = React.forwardRef(function AutocompleteInputComponent(props, ref) {
const defaultRenderItems = ({ item }) => <Text>{String(item)}</Text>;
const { data, containerStyle, hideResults, inputContainerStyle, listContainerStyle, onShowResults, onStartShouldSetResponderCapture = () => false, renderResultList: renderResultListFunction = DefaultResultList, renderTextInput: renderTextInputFunction = DefaultTextInput, flatListProps, style, ...textInputProps } = props;
function renderResultList() {
const listProps = {
const { data, containerStyle, hideResults, inputContainerStyle, listContainerStyle, onShowResults, onStartShouldSetResponderCapture = () => false, renderResultList: ResultList = FlatList, renderTextInput: AutocompleteTextInput = TextInput, flatListProps, style, ...textInputProps } = props;
function ResultListWrapper() {
const resultListProps = {
data,
renderItem: defaultRenderItems,
renderItem: defaultRenderItem,
keyExtractor: defaultKeyExtractor,

@@ -26,6 +22,6 @@ ...flatListProps,

};
return renderResultListFunction(listProps);
return <ResultList {...resultListProps}/>;
}
function renderTextInput() {
const renderProps = {
function TextInputWrapper() {
const autocompleteTextInputProps = {
...textInputProps,

@@ -35,3 +31,3 @@ style: [styles.input, style],

};
return renderTextInputFunction(renderProps);
return <AutocompleteTextInput {...autocompleteTextInputProps}/>;
}

@@ -41,5 +37,7 @@ const showResults = data.length > 0;

return (<View style={[styles.container, containerStyle]}>
<View style={[styles.inputContainer, inputContainerStyle]}>{renderTextInput()}</View>
<View style={[styles.inputContainer, inputContainerStyle]}>
<TextInputWrapper />
</View>
{!hideResults && (<View style={listContainerStyle} onStartShouldSetResponderCapture={onStartShouldSetResponderCapture}>
{showResults && renderResultList()}
{showResults && <ResultListWrapper />}
</View>)}

@@ -46,0 +44,0 @@ </View>);

{
"name": "react-native-autocomplete-input",
"version": "5.5.1",
"version": "5.5.2",
"description": "Pure javascript autocomplete input for react-native",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc