Skip to content

feat: Added searchKeyboardType for search input type #320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ yarn add react-native-element-dropdown
| data | Array | Yes | Data is a plain array |
| labelField | String | Yes | Extract the label from the data item |
| valueField | String | Yes | Extract the primary key from the data item |
| searchField | String | No | Specify the field of data list you want to search |
| searchField | String | No | Specify the field of data list you want to search |
| searchKeyboardType | KeyboardTypeOptions | No | Specify the field of keyboard type list you want to use |
| onChange | (item: object) => void | Yes | Selection callback |
| onChangeText | (search: string) => void | No | Callback that is called when the text input's text changes |
| onChangeText | (search: string) => void | No | Callback that is called when the text input's text changes |
| value | Item | No | Set default value |
| placeholder | String | No | The string that will be rendered before dropdown has been selected |
| placeholderStyle | TextStyle | No | Styling for text placeholder |
Expand Down
2 changes: 2 additions & 0 deletions src/components/Dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const DropdownComponent: <T>(
labelField,
valueField,
searchField,
searchKeyboardType,
value,
activeColor = '#F6F7F8',
fontFamily,
Expand Down Expand Up @@ -560,6 +561,7 @@ const DropdownComponent: <T>(
inputStyle={[inputSearchStyle, font()]}
value={searchText}
autoCorrect={false}
keyboardType={searchKeyboardType || 'default'}
placeholder={searchPlaceholder}
onChangeText={(e) => {
if (onChangeText) {
Expand Down
2 changes: 2 additions & 0 deletions src/components/Dropdown/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {
TextProps,
ImageStyle,
FlatListProps,
KeyboardTypeOptions,
} from 'react-native';

export type IDropdownRef = {
Expand Down Expand Up @@ -45,6 +46,7 @@ export interface DropdownProps<T> {
searchPlaceholderTextColor?: string;
disable?: boolean;
autoScroll?: boolean;
searchKeyboardType? : KeyboardTypeOptions | 'default';
showsVerticalScrollIndicator?: boolean;
dropdownPosition?: 'auto' | 'top' | 'bottom';
flatListProps?: Omit<FlatListProps<any>, 'renderItem' | 'data'>;
Expand Down