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
This commit is contained in:
Nadiia D
2021-03-02 18:04:28 -08:00
committed by Facebook GitHub Bot
parent 6ccd0cdebb
commit 397bfa6ad7
@@ -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) || {};
@@ -1105,6 +1112,7 @@ function InternalTextInput(props: Props): React.Node {
{...eventHandlers}
accessible={accessible}
blurOnSubmit={blurOnSubmit}
caretHidden={caretHidden}
dataDetectorTypes={props.dataDetectorTypes}
focusable={focusable}
mostRecentEventCount={mostRecentEventCount}
@@ -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}