Skip to content

Commit

Permalink
changes after cr
Browse files Browse the repository at this point in the history
  • Loading branch information
OlimpiaZurek committed Apr 5, 2024
1 parent f91c45f commit 1f3fd22
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
#import <React/RCTBackedTextInputDelegateAdapter.h>
#import <React/RCTTextAttributes.h>

//the UITextSelectionRect subclass needs to be created because the original version is not writable
@interface CustomTextSelectionRect : UITextSelectionRect
// subclass needs to be created as UITextSelectionRect is an abstract base class
@interface RCTTextSelectionRect : UITextSelectionRect

@property (nonatomic, assign) CGRect rect;
@property (nonatomic, assign) NSWritingDirection writingDirection;
Expand All @@ -24,7 +24,7 @@ @interface CustomTextSelectionRect : UITextSelectionRect

@end

@implementation CustomTextSelectionRect {
@implementation RCTTextSelectionRect {
CGRect _customRect;
NSWritingDirection _customWritingDirection;
BOOL _customContainsStart;
Expand Down Expand Up @@ -351,13 +351,13 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position
return originalRect;
}

- (NSArray *)selectionRectsForRange:(UITextRange *)range {
- (NSArray<UITextSelectionRect *> *)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];
RCTTextSelectionRect *customTextRect = [[RCTTextSelectionRect alloc] init];

customTextRect.rect = CGRectMake(rect.rect.origin.x, rect.rect.origin.y + _caretYOffset, rect.rect.size.width, _caretHeight);
customTextRect.writingDirection = rect.writingDirection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2405,18 +2405,6 @@ declare export default HostComponent<NativeProps>;
"
`;

exports[`public API should not change unintentionally Libraries/Components/TextInput/InputAccessoryView.js 1`] = `
"type Props = $ReadOnly<{|
+children: React.Node,
nativeID?: ?string,
style?: ?ViewStyleProp,
backgroundColor?: ?ColorValue,
|}>;
declare const InputAccessoryView: React.AbstractComponent<Props>;
declare export default typeof InputAccessoryView;
"
`;

exports[`public API should not change unintentionally Libraries/Components/TextInput/RCTInputAccessoryViewNativeComponent.js 1`] = `
"export * from \\"../../../src/private/specs/components/RCTInputAccessoryViewNativeComponent\\";
declare export default typeof RCTInputAccessoryViewNativeComponent;
Expand Down

0 comments on commit 1f3fd22

Please sign in to comment.