Skip to content
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

Add autoCapitalize on textInput #51

Open
wants to merge 4 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
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 ? capitalizeFirstLetter(valueExtractor(value)) : valueExtractor(value);
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