Skip to content

Commit

Permalink
minor changes after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
OlimpiaZurek committed May 23, 2023
1 parent 6513a91 commit 0f17587
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion Libraries/Components/TextInput/TextInput.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -576,12 +576,14 @@ export interface TextInputProps
/**
* Allows to adjust caret height.
* The default value is 0, which means the height of the caret will be calculated automatically
* @platform ios
*/
caretHeight?: number | undefined;

/**
* Allows to adjust caret postiion relative to the Y axis
* Allows to adjust caret position relative to the Y axis
* The default value is 0.
* @platform ios
*/
caretYOffset?: number | undefined;

Expand Down
6 changes: 4 additions & 2 deletions Libraries/Components/TextInput/TextInput.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,14 @@ export type Props = $ReadOnly<{|
/**
* Allows to adjust caret height.
* The default value is 0, which means the height of the caret will be calculated automatically
* @platform ios
*/

caretYOffset?: ?number,

/**
* Allows to adjust caret postiion relative to the Y axis
* Allows to adjust caret position relative to the Y axis
* The default value is 0.
* @platform ios
*/
caretYHeight?: ?number,

Expand Down
6 changes: 3 additions & 3 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,12 +371,14 @@ type IOSProps = $ReadOnly<{|
/**
* Allows to adjust caret height.
* The default value is 0, which means the height of the caret will be calculated automatically
* @platform ios
*/
caretYOffset?: ?number,

/**
* Allows to adjust caret postiion relative to the Y axis
* Allows to adjust caret position relative to the Y axis
* The default value is 0.
* @platform ios
*/
caretHeight?: ?number,
|}>;
Expand Down Expand Up @@ -1470,8 +1472,6 @@ function InternalTextInput(props: Props): React.Node {
selection={selection}
style={style}
text={text}
caretYOffset={props.caretYOffset}
caretHeight={props.caretHeight}
/>
);
} else if (Platform.OS === 'android') {
Expand Down
5 changes: 3 additions & 2 deletions Libraries/Text/TextInput/Multiline/RCTUITextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,11 @@ - (CGRect)caretRectForPosition:(UITextPosition *)position
originalRect.origin.y += _caretYOffset;
}

if(_caretHeight != 0) {
if(_caretHeight != 0) {
originalRect.size.height = _caretHeight;
}
return originalRect;

return originalRect;
}

- (NSArray *)selectionRectsForRange:(UITextRange *)range {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class TextInputTraits final {
* iOS-only (inherently iOS-specific)
* Default value: 0 with a default font.
*/

int caretHeight{0};

/*
Expand Down

0 comments on commit 0f17587

Please sign in to comment.