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 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
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 [email protected] 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
16 changes: 8 additions & 8 deletions docs/Libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ With that in mind we exposed many of these features as independent static librar
For most of the libs it will be as simples as dragging two files, sometimes a third
step will be necessary, but no more than that.

_All the libraries we ship with React Native live on the `Libraries` folder in
the root of the repository. Some of them are pure JavaScript, and you just need
_All the libraries we ship with React Native live in the `Libraries` folder in
the root of the repository. Some of them are pure JavaScript and you just need
to `require` it. Other libraries also rely on some native code, in that case
you'll have to add these files to your app, otherwise the app will throw an
error as soon as you try to use the library._
Expand All @@ -26,7 +26,7 @@ error as soon as you try to use the library._

### Step 1

If the library has native code, there must be a `.xcodeproj` file inside it's
If the library has native code, there must be an `.xcodeproj` file inside it's
folder.
Drag this file to your project on Xcode (usually under the `Libaries` group
on Xcode);
Expand All @@ -47,20 +47,20 @@ Not every library will need this step, what you need to consider is:

_Do I need to know the contents of the library at compile time?_

What that means is, are you using this library on the native site or just in
What that means is, are you using this library on the native side or just in
JavaScript? If you are just using it in JavaScript, you are good to go!


This step is not necessary for all libraries that we ship we React Native but
This step is not necessary for all libraries that we ship with React Native but is necessary for
`PushNotificationIOS` and `LinkingIOS`.

In the case of the `PushNotificationIOS` for example, you have to call a method
on the library from your `AppDelegate` every time a new push notifiation is
In the case of `PushNotificationIOS` for example, you have to call a method
on the library from your `AppDelegate` every time a new push notification is
received.

For that we need to know the library's headers. To achieve that you have to go
to your project's file, select `Build Settings` and search for `Header Search
Paths`. There you should include the path to you library (if it has relevant
Paths`. There you should include the path to your library (if it has relevant
files on subdirectories remember to make it `recursive`, like `React` on the
example).

Expand Down