diff --git a/README.md b/README.md index 647040a..436fd59 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,8 @@ yarn add react-native-element-dropdown | 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 | -| selectedTextStyle | TextStyle | No | Styling for selected text | +| selectedText | TextStyle | No | Styling for selected text | +| selectedTextStyle | TextStyle | No | Custom selected text | | selectedTextProps | TextProps | No | Text Props for selected text. Ex: numberOfLines={1} | | style | ViewStyle | No | Styling for view container | | containerStyle | ViewStyle | No | Styling for list container | diff --git a/src/components/Dropdown/index.tsx b/src/components/Dropdown/index.tsx index 2a73f2f..b8d789e 100644 --- a/src/components/Dropdown/index.tsx +++ b/src/components/Dropdown/index.tsx @@ -51,6 +51,7 @@ const DropdownComponent = React.forwardRef>( style = {}, containerStyle, placeholderStyle, + selectedText, selectedTextStyle, itemContainerStyle, itemTextStyle, @@ -460,7 +461,7 @@ const DropdownComponent = React.forwardRef>( {...selectedTextProps} > {isSelected !== null - ? _get(currentValue, labelField) + ? (selectedText ? selectedText : _get(currentValue, labelField)) : placeholder} {renderRightIcon ? ( diff --git a/src/components/Dropdown/model.ts b/src/components/Dropdown/model.ts index e4212a9..a001ce2 100644 --- a/src/components/Dropdown/model.ts +++ b/src/components/Dropdown/model.ts @@ -24,6 +24,7 @@ export interface DropdownProps { style?: StyleProp; containerStyle?: StyleProp; placeholderStyle?: StyleProp; + selectedText?: string; selectedTextStyle?: StyleProp; selectedTextProps?: TextProps; itemContainerStyle?: StyleProp;