Skip to content

Commit

Permalink
editable property was implemented for RCTUITextField
Browse files Browse the repository at this point in the history
Summary: `UITextField` surprisingly does not have `editable` property (only UITextView does), so we have to implement it ourselfs.

Reviewed By: javache

Differential Revision: D5153070

fbshipit-source-id: 5a76c623fc5c7c3eec10c600c942cf82c93833cd
  • Loading branch information
shergin authored and facebook-github-bot committed Jun 27, 2017
1 parent f954f3d commit 719f000
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Libraries/Text/RCTUITextField.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign, readonly) BOOL textWasPasted;
@property (nonatomic, strong, nullable) UIColor *placeholderColor;
@property (nonatomic, assign) UIEdgeInsets textContainerInset;
@property (nonatomic, assign, getter=isEditable) BOOL editable;

@end

Expand Down
10 changes: 10 additions & 0 deletions Libraries/Text/RCTUITextField.m
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ - (void)_updatePlaceholder
attributes:attributes];
}

- (BOOL)isEditable
{
return self.userInteractionEnabled;
}

- (void)setEditable:(BOOL)editable
{
self.userInteractionEnabled = editable;
}

#pragma mark - Caret Manipulation

- (CGRect)caretRectForPosition:(UITextPosition *)position
Expand Down

0 comments on commit 719f000

Please sign in to comment.