From 2c551ec17bf501b41d73bab057a8ae4f40a6fcb4 Mon Sep 17 00:00:00 2001 From: Cory Smith Date: Fri, 27 Mar 2015 13:37:14 -0600 Subject: [PATCH 1/2] Adding support for secureTextEntry to TextInput --- Libraries/Components/TextInput/TextInput.ios.js | 9 ++++++++- React/Views/RCTTextFieldManager.m | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Libraries/Components/TextInput/TextInput.ios.js b/Libraries/Components/TextInput/TextInput.ios.js index 02fec4d5a3a700..b6c02a1cf1c1b0 100644 --- a/Libraries/Components/TextInput/TextInput.ios.js +++ b/Libraries/Components/TextInput/TextInput.ios.js @@ -47,6 +47,7 @@ var RCTTextViewAttributes = merge(ReactIOSViewAttributes.UIView, { mostRecentEventCounter: true, placeholder: true, placeholderTextColor: true, + secureTextEntry: true, text: true, }); @@ -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 @@ -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} @@ -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} diff --git a/React/Views/RCTTextFieldManager.m b/React/Views/RCTTextFieldManager.m index 087dc5b26421d2..870255e3487c30 100644 --- a/React/Views/RCTTextFieldManager.m +++ b/React/Views/RCTTextFieldManager.m @@ -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) From d429a4abe05b9aa12becb8061f91f31546710da1 Mon Sep 17 00:00:00 2001 From: Cory Smith Date: Sun, 29 Mar 2015 17:12:13 -0600 Subject: [PATCH 2/2] Fixing some spelling mistakes / wording in the docs --- docs/Libraries.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/Libraries.md b/docs/Libraries.md index 9dad157c363461..f51bfa353104d0 100644 --- a/docs/Libraries.md +++ b/docs/Libraries.md @@ -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._ @@ -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); @@ -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).