Skip to content

Commit 168e73f

Browse files
committed
fix: iOS cursor flicker on first character
1 parent bbffecd commit 168e73f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/components/TextInput/BaseTextInput/implementation/index.native.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ function BaseTextInput(
278278

279279
// Height fix is needed only for Text single line inputs
280280
const shouldApplyHeight = !isMultiline && !isMarkdownEnabled;
281+
282+
// Fix iOS cursor jumping when entering first character using HW keyboard https://github.com/Expensify/App/pull/59078#issuecomment-2802834037
283+
const selection = inputProps.selection?.end === 0 && inputProps.selection?.start === 0 ? undefined : inputProps.selection;
284+
281285
return (
282286
<>
283287
<View style={[containerStyles]}>
@@ -397,7 +401,7 @@ function BaseTextInput(
397401
keyboardType={inputProps.keyboardType}
398402
inputMode={!disableKeyboard ? inputProps.inputMode : CONST.INPUT_MODE.NONE}
399403
value={uncontrolled ? undefined : value}
400-
selection={inputProps.selection}
404+
selection={selection}
401405
readOnly={isReadOnly}
402406
defaultValue={defaultValue}
403407
markdownStyle={markdownStyle}

0 commit comments

Comments
 (0)