Skip to content
Open
Show file tree
Hide file tree
Changes from 3 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
6 changes: 5 additions & 1 deletion components/Autocomplete/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Autocomplete extends Component {
if (resetOnSelect) {
this.setState({inputValue: ""});
} else {
const capitalizedValue = capitalizeFirstLetter(valueExtractor(value));
const capitalizedValue = this.props.firstLetterCapital === true ? capitalizeFirstLetter(valueExtractor(value)) : valueExtractor(value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cleaning to just do this.props.firstLetterCapital for the conditional

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I'm implementing your suggestion, thanks.

this.setState({inputValue: capitalizedValue});
}
}
Expand Down Expand Up @@ -171,6 +171,7 @@ class Autocomplete extends Component {
placeholderColor,
data,
disableFullscreenUI,
autoCapitalize,
...dropdownProps
} = this.props;

Expand All @@ -191,6 +192,7 @@ class Autocomplete extends Component {
autoCorrect={autoCorrect}
keyboardType={keyboardType}
onChangeText={text => this.handleInputChange(text)}
autoCapitalize={autoCapitalize}
onFocus={event => {
if (scrollToInput) {
scrollToInput(findNodeHandle(event.target));
Expand Down Expand Up @@ -230,6 +232,7 @@ Autocomplete.defaultProps = {
highlightText: true,
waitInterval: WAIT_INTERVAL,
resetOnSelect: false,
firstLetterCapital: true,
};

Autocomplete.propTypes = {
Expand All @@ -245,6 +248,7 @@ Autocomplete.propTypes = {
autoCorrect: bool,
keyboardType: string,
resetOnSelect: bool,
firstLetterCapital: bool,

valueExtractor: func,
renderIcon: func,
Expand Down
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type AutocompleteProps = {
rightContentStyle?: StyleProp<ViewStyle>;
rightContentItemStyle?: StyleProp<TextStyle>;
listHeaderTextStyle?: StyleProp<TextStyle>;
listItemTextStyle?: StyleProp<TextStyle>;
overlayStyle?: StyleProp<TextStyle>;
pickerStyle?: StyleProp<TextStyle>;
containerStyle?: StyleProp<ViewStyle>;
Expand Down