Skip to content

Commit

Permalink
Hide caret during test runs
Browse files Browse the repository at this point in the history
Summary:
Changelog:
[General][Changed] Hide caret in the TextInput during test runs.

Reviewed By: lunaleaps

Differential Revision: D26728766

fbshipit-source-id: b75827f00b4d5c6243d93106093f97b40dc4b366
  • Loading branch information
Nadiia D authored and facebook-github-bot committed Mar 3, 2021
1 parent 6ccd0cd commit 397bfa6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -1083,6 +1083,13 @@ function InternalTextInput(props: Props): React.Node {
],
);

// Hide caret during test runs due to a flashing caret
// makes screenshot tests flakey
let caretHidden = props.caretHidden;
if (Platform.isTesting) {
caretHidden = true;
}

// TextInput handles onBlur and onFocus events
// so omitting onBlur and onFocus pressability handlers here.
const {onBlur, onFocus, ...eventHandlers} = usePressability(config) || {};
Expand All @@ -1105,6 +1112,7 @@ function InternalTextInput(props: Props): React.Node {
{...eventHandlers}
accessible={accessible}
blurOnSubmit={blurOnSubmit}
caretHidden={caretHidden}
dataDetectorTypes={props.dataDetectorTypes}
focusable={focusable}
mostRecentEventCount={mostRecentEventCount}
Expand Down Expand Up @@ -1143,6 +1151,7 @@ function InternalTextInput(props: Props): React.Node {
accessible={accessible}
autoCapitalize={autoCapitalize}
blurOnSubmit={blurOnSubmit}
caretHidden={caretHidden}
children={children}
disableFullscreenUI={props.disableFullscreenUI}
focusable={focusable}
Expand Down

0 comments on commit 397bfa6

Please sign in to comment.