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

Adding support for secureTextEntry to TextInput #362

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
9 changes: 8 additions & 1 deletion Libraries/Components/TextInput/TextInput.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ var RCTTextViewAttributes = merge(ReactIOSViewAttributes.UIView, {
mostRecentEventCounter: true,
placeholder: true,
placeholderTextColor: true,
secureTextEntry: true,
Copy link

Choose a reason for hiding this comment

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

Does this not make it default to true instead of false?

Copy link
Author

Choose a reason for hiding this comment

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

No, the default is false. That just specifies that those attributes are valid

Copy link

Choose a reason for hiding this comment

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

Ah, whoops, thanks! 👍

On Mar 28, 2015, at 9:00 AM, Cory Smith notifications@github.com wrote:

In Libraries/Components/TextInput/TextInput.ios.js:

@@ -47,6 +47,7 @@ var RCTTextViewAttributes = merge(ReactIOSViewAttributes.UIView, {
mostRecentEventCounter: true,
placeholder: true,
placeholderTextColor: true,

  • secureTextEntry: true,
    No, the default is false. That just specifies that those attributes are valid


Reply to this email directly or view it on GitHub.

text: true,
});

Expand Down Expand Up @@ -169,10 +170,14 @@ var TextInput = React.createClass({
* The text color of the placeholder string
*/
placeholderTextColor: PropTypes.string,
/**
* If true, hides the text being entered. Default value is false.
*/
secureTextEntry: PropTypes.bool,
/**
* See DocumentSelectionState.js, some state that is responsible for
* maintaining selection information for a document
*/
*/
selectionState: PropTypes.instanceOf(DocumentSelectionState),
/**
* The default value for the text input
Expand Down Expand Up @@ -339,6 +344,7 @@ var TextInput = React.createClass({
onSubmitEditing={this.props.onSubmitEditing}
onSelectionChangeShouldSetResponder={() => true}
placeholder={this.props.placeholder}
secureTextEntry={this.props.secureTextEntry}
text={this.state.bufferedValue}
autoCapitalize={autoCapitalize}
autoCorrect={this.props.autoCorrect}
Expand Down Expand Up @@ -382,6 +388,7 @@ var TextInput = React.createClass({
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
secureTextEntry={this.props.secureTextEntry}
text={this.state.bufferedValue}
autoCapitalize={autoCapitalize}
autoCorrect={this.props.autoCorrect}
Expand Down
1 change: 1 addition & 0 deletions React/Views/RCTTextFieldManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)
RCT_EXPORT_VIEW_PROPERTY(autoCorrect, BOOL)
RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(secureTextEntry, BOOL)
RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString)
RCT_EXPORT_VIEW_PROPERTY(text, NSString)
RCT_EXPORT_VIEW_PROPERTY(clearButtonMode, UITextFieldViewMode)
Expand Down