diff --git a/README.md b/README.md index 647040a..8dce9e9 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/src/components/Dropdown/index.tsx b/src/components/Dropdown/index.tsx index 9c6a599..c6d8b31 100644 --- a/src/components/Dropdown/index.tsx +++ b/src/components/Dropdown/index.tsx @@ -64,6 +64,7 @@ const DropdownComponent: ( labelField, valueField, searchField, + searchKeyboardType, value, activeColor = '#F6F7F8', fontFamily, @@ -560,6 +561,7 @@ const DropdownComponent: ( inputStyle={[inputSearchStyle, font()]} value={searchText} autoCorrect={false} + keyboardType={searchKeyboardType || 'default'} placeholder={searchPlaceholder} onChangeText={(e) => { if (onChangeText) { diff --git a/src/components/Dropdown/model.ts b/src/components/Dropdown/model.ts index a32bba5..1a05bb5 100644 --- a/src/components/Dropdown/model.ts +++ b/src/components/Dropdown/model.ts @@ -5,6 +5,7 @@ import type { TextProps, ImageStyle, FlatListProps, + KeyboardTypeOptions, } from 'react-native'; export type IDropdownRef = { @@ -45,6 +46,7 @@ export interface DropdownProps { searchPlaceholderTextColor?: string; disable?: boolean; autoScroll?: boolean; + searchKeyboardType? : KeyboardTypeOptions | 'default'; showsVerticalScrollIndicator?: boolean; dropdownPosition?: 'auto' | 'top' | 'bottom'; flatListProps?: Omit, 'renderItem' | 'data'>;