Skip to content

Commit e13b9c6

Browse files
sherginfacebook-github-bot
authored andcommitted
RCTTextField was spliited into two classes
Summary: Motivation: * We maintain two different implementation of <TextInput> (multilined and singlelined), this change makes the implementations much similar which will help us to support and improve both of them in the (near) future; * We have to have separated RCTView-based container view for (TextField) to support sofisticated bordering and so on; * It opens to us possibility to unify UITextView and UITextField subclasses and remove code duplication across RCTTextView and RCTTextField; * Making things decoupled in general will allow us to fix existing bugs with events. Reviewed By: mmmulani Differential Revision: D5083010 fbshipit-source-id: 2f2d42c2244d2b39256c51480c1f16f4e3947c01
1 parent 4865022 commit e13b9c6

File tree

10 files changed

+373
-193
lines changed

10 files changed

+373
-193
lines changed

Libraries/Text/RCTText.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
58B511D01A9E6C5C00147676 /* RCTShadowText.m in Sources */ = {isa = PBXBuildFile; fileRef = 58B511CB1A9E6C5C00147676 /* RCTShadowText.m */; };
2828
58B511D11A9E6C5C00147676 /* RCTTextManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 58B511CD1A9E6C5C00147676 /* RCTTextManager.m */; };
2929
58B512161A9E6EFF00147676 /* RCTText.m in Sources */ = {isa = PBXBuildFile; fileRef = 58B512141A9E6EFF00147676 /* RCTText.m */; };
30+
59AF89AA1EDCBCC700F004B1 /* RCTUITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 59AF89A91EDCBCC700F004B1 /* RCTUITextField.m */; };
31+
59AF89AB1EDCBCC700F004B1 /* RCTUITextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 59AF89A91EDCBCC700F004B1 /* RCTUITextField.m */; };
3032
59B125C91E6E4E15004E2A67 /* RCTUITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59B125C81E6E4E15004E2A67 /* RCTUITextView.m */; };
3133
59B125CA1E6E4E15004E2A67 /* RCTUITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 59B125C81E6E4E15004E2A67 /* RCTUITextView.m */; };
3234
59F60E911E661BDD0081153B /* RCTShadowTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 59F60E8E1E661BDD0081153B /* RCTShadowTextField.m */; };
@@ -60,6 +62,8 @@
6062
58B511CD1A9E6C5C00147676 /* RCTTextManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTTextManager.m; sourceTree = "<group>"; };
6163
58B512141A9E6EFF00147676 /* RCTText.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTText.m; sourceTree = "<group>"; };
6264
58B512151A9E6EFF00147676 /* RCTText.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTText.h; sourceTree = "<group>"; };
65+
59AF89A81EDCBCC700F004B1 /* RCTUITextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUITextField.h; sourceTree = "<group>"; };
66+
59AF89A91EDCBCC700F004B1 /* RCTUITextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUITextField.m; sourceTree = "<group>"; };
6367
59B125C71E6E4E15004E2A67 /* RCTUITextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUITextView.h; sourceTree = "<group>"; };
6468
59B125C81E6E4E15004E2A67 /* RCTUITextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUITextView.m; sourceTree = "<group>"; };
6569
59F60E8D1E661BDD0081153B /* RCTShadowTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTShadowTextField.h; sourceTree = "<group>"; };
@@ -101,6 +105,8 @@
101105
131B6ABD1AF0CD0600FFC3E0 /* RCTTextView.m */,
102106
131B6ABE1AF0CD0600FFC3E0 /* RCTTextViewManager.h */,
103107
131B6ABF1AF0CD0600FFC3E0 /* RCTTextViewManager.m */,
108+
59AF89A81EDCBCC700F004B1 /* RCTUITextField.h */,
109+
59AF89A91EDCBCC700F004B1 /* RCTUITextField.m */,
104110
59B125C71E6E4E15004E2A67 /* RCTUITextView.h */,
105111
59B125C81E6E4E15004E2A67 /* RCTUITextView.m */,
106112
);
@@ -196,6 +202,7 @@
196202
2D3B5F391D9B106F00451313 /* RCTTextField.m in Sources */,
197203
2D3B5F361D9B106F00451313 /* RCTShadowText.m in Sources */,
198204
2D3B5F3B1D9B106F00451313 /* RCTTextView.m in Sources */,
205+
59AF89AB1EDCBCC700F004B1 /* RCTUITextField.m in Sources */,
199206
2D3B5F3A1D9B106F00451313 /* RCTTextFieldManager.m in Sources */,
200207
2D3B5F341D9B103100451313 /* RCTRawTextManager.m in Sources */,
201208
59F60E921E661BDD0081153B /* RCTShadowTextField.m in Sources */,
@@ -217,6 +224,7 @@
217224
58B511CE1A9E6C5C00147676 /* RCTRawTextManager.m in Sources */,
218225
19FC5C851D41A4120090108F /* RCTTextSelection.m in Sources */,
219226
1362F1001B4D51F400E06D8C /* RCTTextField.m in Sources */,
227+
59AF89AA1EDCBCC700F004B1 /* RCTUITextField.m in Sources */,
220228
58B512161A9E6EFF00147676 /* RCTText.m in Sources */,
221229
1362F1011B4D51F400E06D8C /* RCTTextFieldManager.m in Sources */,
222230
59F60E911E661BDD0081153B /* RCTShadowTextField.m in Sources */,

Libraries/Text/RCTTextField.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,28 @@
1010
#import <UIKit/UIKit.h>
1111

1212
#import <React/RCTComponent.h>
13+
#import <React/RCTView.h>
1314

1415
@class RCTBridge;
16+
@class RCTUITextField;
1517

16-
@interface RCTTextField : UITextField
18+
@interface RCTTextField : RCTView
1719

1820
@property (nonatomic, assign) BOOL caretHidden;
1921
@property (nonatomic, assign) BOOL selectTextOnFocus;
2022
@property (nonatomic, assign) BOOL blurOnSubmit;
21-
@property (nonatomic, strong) UIColor *placeholderTextColor;
2223
@property (nonatomic, assign) NSInteger mostRecentEventCount;
2324
@property (nonatomic, strong) NSNumber *maxLength;
2425
@property (nonatomic, assign) UIEdgeInsets reactPaddingInsets;
2526
@property (nonatomic, assign) UIEdgeInsets reactBorderInsets;
2627

2728
@property (nonatomic, copy) RCTDirectEventBlock onSelectionChange;
2829

30+
@property (nonatomic, strong) RCTUITextField *textField;
31+
2932
- (instancetype)initWithBridge:(RCTBridge *)bridge NS_DESIGNATED_INITIALIZER;
3033

34+
- (instancetype)init NS_UNAVAILABLE;
35+
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
36+
3137
@end

0 commit comments

Comments
 (0)