Skip to content

Commit

Permalink
remove double double underscores and fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
OlimpiaZurek committed Feb 26, 2024
1 parent f55a9ff commit f91c45f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ const RCTTextInputViewConfig = {
editable: true,
inputAccessoryViewID: true,
caretHidden: true,
caretHeight: true,
caretYOffset: true,
enablesReturnKeyAutomatically: true,
placeholderTextColor: {
process: require('../../StyleSheet/processColor').default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,27 @@
//the UITextSelectionRect subclass needs to be created because the original version is not writable
@interface CustomTextSelectionRect : UITextSelectionRect

@property (nonatomic) CGRect _rect;
@property (nonatomic) NSWritingDirection _writingDirection;
@property (nonatomic) BOOL _containsStart; // Returns YES if the rect contains the start of the selection.
@property (nonatomic) BOOL _containsEnd; // Returns YES if the rect contains the end of the selection.
@property (nonatomic) BOOL _isVertical; // Returns YES if the rect is for vertically oriented text.
@property (nonatomic, assign) CGRect rect;
@property (nonatomic, assign) NSWritingDirection writingDirection;
@property (nonatomic, assign) BOOL containsStart; // Returns YES if the rect contains the start of the selection.
@property (nonatomic, assign) BOOL containsEnd; // Returns YES if the rect contains the end of the selection.
@property (nonatomic, assign) BOOL isVertical; // Returns YES if the rect is for vertically oriented text.

@end

@implementation CustomTextSelectionRect

- (CGRect)rect {
return __rect;
}

- (NSWritingDirection)writingDirection {
return __writingDirection;
@implementation CustomTextSelectionRect {
CGRect _customRect;
NSWritingDirection _customWritingDirection;
BOOL _customContainsStart;
BOOL _customContainsEnd;
BOOL _customIsVertical;
}

- (BOOL)containsStart {
return __containsStart;
}

- (BOOL)containsEnd {
return __containsEnd;
}

- (BOOL)isVertical {
return __isVertical;
}
@synthesize rect = _customRect;
@synthesize writingDirection = _customWritingDirection;
@synthesize containsStart = _customContainsStart;
@synthesize containsEnd = _customContainsEnd;
@synthesize isVertical = _customIsVertical;

@end

Expand Down Expand Up @@ -360,25 +352,25 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position
}

- (NSArray *)selectionRectsForRange:(UITextRange *)range {
NSArray *superRects = [super selectionRectsForRange:range];
if(_caretYOffset != 0 && _caretHeight != 0) {
NSMutableArray *customTextSelectionRects = [NSMutableArray array];

for (UITextSelectionRect *rect in superRects) {
CustomTextSelectionRect *customTextRect = [[CustomTextSelectionRect alloc] init];

customTextRect._rect = CGRectMake(rect.rect.origin.x, rect.rect.origin.y + _caretYOffset, rect.rect.size.width, _caretHeight);
customTextRect._writingDirection = rect.writingDirection;
customTextRect._containsStart = rect.containsStart;
customTextRect._containsEnd = rect.containsEnd;
customTextRect._isVertical = rect.isVertical;
[customTextSelectionRects addObject:customTextRect];
}
NSArray *superRects = [super selectionRectsForRange:range];
if(_caretYOffset != 0 && _caretHeight != 0) {
NSMutableArray *customTextSelectionRects = [NSMutableArray array];

return customTextSelectionRects;
for (UITextSelectionRect *rect in superRects) {
CustomTextSelectionRect *customTextRect = [[CustomTextSelectionRect alloc] init];

}
return superRects;
customTextRect.rect = CGRectMake(rect.rect.origin.x, rect.rect.origin.y + _caretYOffset, rect.rect.size.width, _caretHeight);
customTextRect.writingDirection = rect.writingDirection;
customTextRect.containsStart = rect.containsStart;
customTextRect.containsEnd = rect.containsEnd;
customTextRect.isVertical = rect.isVertical;
[customTextSelectionRects addObject:customTextRect];
}

return customTextSelectionRects;

}
return superRects;

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, weak) id<RCTBackedTextInputDelegate> textInputDelegate;

@property (nonatomic, assign) BOOL caretHidden;
@property (nonatomic, assign) BOOL caretYOffset;
@property (nonatomic, assign) BOOL caretHeight;
@property (nonatomic, assign) BOOL contextMenuHidden;
@property (nonatomic, assign, readonly) BOOL textWasPasted;
@property (nonatomic, assign, readonly) BOOL dictationRecognizing;
Expand Down

0 comments on commit f91c45f

Please sign in to comment.