Skip to content

Commit 397bfa6

Browse files
Nadiia Dfacebook-github-bot
Nadiia D
authored andcommitted
Hide caret during test runs
Summary: Changelog: [General][Changed] Hide caret in the TextInput during test runs. Reviewed By: lunaleaps Differential Revision: D26728766 fbshipit-source-id: b75827f00b4d5c6243d93106093f97b40dc4b366
1 parent 6ccd0cd commit 397bfa6

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Libraries/Components/TextInput/TextInput.js

+9
Original file line numberDiff line numberDiff line change
@@ -1083,6 +1083,13 @@ function InternalTextInput(props: Props): React.Node {
10831083
],
10841084
);
10851085

1086+
// Hide caret during test runs due to a flashing caret
1087+
// makes screenshot tests flakey
1088+
let caretHidden = props.caretHidden;
1089+
if (Platform.isTesting) {
1090+
caretHidden = true;
1091+
}
1092+
10861093
// TextInput handles onBlur and onFocus events
10871094
// so omitting onBlur and onFocus pressability handlers here.
10881095
const {onBlur, onFocus, ...eventHandlers} = usePressability(config) || {};
@@ -1105,6 +1112,7 @@ function InternalTextInput(props: Props): React.Node {
11051112
{...eventHandlers}
11061113
accessible={accessible}
11071114
blurOnSubmit={blurOnSubmit}
1115+
caretHidden={caretHidden}
11081116
dataDetectorTypes={props.dataDetectorTypes}
11091117
focusable={focusable}
11101118
mostRecentEventCount={mostRecentEventCount}
@@ -1143,6 +1151,7 @@ function InternalTextInput(props: Props): React.Node {
11431151
accessible={accessible}
11441152
autoCapitalize={autoCapitalize}
11451153
blurOnSubmit={blurOnSubmit}
1154+
caretHidden={caretHidden}
11461155
children={children}
11471156
disableFullscreenUI={props.disableFullscreenUI}
11481157
focusable={focusable}

0 commit comments

Comments
 (0)