Skip to content
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
6 changes: 6 additions & 0 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ const TextInput = React.createClass({
* If `false`, disables auto-correct. The default value is `true`.
*/
autoCorrect: PropTypes.bool,
/**
* If `false`, disables spell-check style (i.e. red underlines).
* The default value is inherited from `autoCorrect`.
* @platform ios
*/
spellCheck: PropTypes.bool,
/**
* If `true`, focuses the input on `componentDidMount`.
* The default value is `false`.
Expand Down
1 change: 1 addition & 0 deletions Libraries/Text/RCTConvert+Text.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@
@interface RCTConvert (Text)

+ (UITextAutocorrectionType)UITextAutocorrectionType:(id)json;
+ (UITextSpellCheckingType)UITextSpellCheckingType:(id)json;

@end
8 changes: 8 additions & 0 deletions Libraries/Text/RCTConvert+Text.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,12 @@ + (UITextAutocorrectionType)UITextAutocorrectionType:(id)json
UITextAutocorrectionTypeNo;
}

+ (UITextSpellCheckingType)UITextSpellCheckingType:(id)json
{
return
json == nil ? UITextSpellCheckingTypeDefault :
[RCTConvert BOOL:json] ? UITextSpellCheckingTypeYes :
UITextSpellCheckingTypeNo;
}

@end
1 change: 1 addition & 0 deletions Libraries/Text/RCTTextFieldManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ - (BOOL)textFieldShouldEndEditing:(RCTTextField *)textField

RCT_EXPORT_VIEW_PROPERTY(caretHidden, BOOL)
RCT_REMAP_VIEW_PROPERTY(autoCorrect, autocorrectionType, UITextAutocorrectionType)
RCT_REMAP_VIEW_PROPERTY(spellCheck, spellCheckingType, UITextSpellCheckingType)
RCT_REMAP_VIEW_PROPERTY(editable, enabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString)
RCT_EXPORT_VIEW_PROPERTY(placeholderTextColor, UIColor)
Expand Down
1 change: 1 addition & 0 deletions Libraries/Text/RCTTextView.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@interface RCTTextView : RCTView <UITextViewDelegate>

@property (nonatomic, assign) UITextAutocorrectionType autocorrectionType;
@property (nonatomic, assign) UITextSpellCheckingType spellCheckingType;
@property (nonatomic, assign) BOOL blurOnSubmit;
@property (nonatomic, assign) BOOL clearTextOnFocus;
@property (nonatomic, assign) BOOL selectTextOnFocus;
Expand Down
10 changes: 10 additions & 0 deletions Libraries/Text/RCTTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,16 @@ - (UITextAutocorrectionType)autocorrectionType
return _textView.autocorrectionType;
}

- (void)setSpellCheckingType:(UITextSpellCheckingType)spellCheckingType
{
_textView.spellCheckingType = spellCheckingType;
}

- (UITextSpellCheckingType)spellCheckingType
{
return _textView.spellCheckingType;
}

- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
if (_selectTextOnFocus) {
Expand Down
1 change: 1 addition & 0 deletions Libraries/Text/RCTTextViewManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ - (UIView *)view

RCT_REMAP_VIEW_PROPERTY(autoCapitalize, textView.autocapitalizationType, UITextAutocapitalizationType)
RCT_REMAP_VIEW_PROPERTY(autoCorrect, autocorrectionType, UITextAutocorrectionType)
RCT_REMAP_VIEW_PROPERTY(spellCheck, spellCheckingType, UITextSpellCheckingType)
RCT_EXPORT_VIEW_PROPERTY(blurOnSubmit, BOOL)
RCT_EXPORT_VIEW_PROPERTY(clearTextOnFocus, BOOL)
RCT_REMAP_VIEW_PROPERTY(color, textView.textColor, UIColor)
Expand Down