Files
Nick Gerleman 3f88821167 Avoid TextInput example styles causing non-deterministic rendering on iOS (#43599)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43599

iOS E2E tests non-deterministic rendering happens around examples with a border set to `StyleSheet.hairlineWidth`. That value has special subpixel math, that doesn't seem to render consistently on iOS (this is its own bug).

To unblock adding some new E2E iOS TextInput tests, this removes usage of `hairlineWidth` in styles, and more generally, tries to unify TextInput styles in the examples.

This will break a whole bunch of RNTester Jest E2E baselines on different apps, which I will update from land-time runs or after continuous builds are available for different endpoints.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D55213090

fbshipit-source-id: 6d81b9355adc538a3ade6f50ef93c3ca08782ae7
2024-03-29 02:41:26 -07:00

52 lines
1.1 KiB
JavaScript

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
* @oncall react_native
*/
import {RNTesterThemeContext} from '../../components/RNTesterTheme';
import React, {forwardRef, useContext} from 'react';
import {StyleSheet, TextInput} from 'react-native';
const ExampleTextInput: React.AbstractComponent<
React.ElementConfig<typeof TextInput>,
$ReadOnly<{|
...React.ElementRef<typeof TextInput>,
|}>,
> = forwardRef((props, ref) => {
const theme = useContext(RNTesterThemeContext);
return (
<TextInput
ref={ref}
{...props}
style={[
{
color: theme.LabelColor,
backgroundColor: theme.SecondaryGroupedBackgroundColor,
borderColor: theme.QuaternaryLabelColor,
},
styles.input,
props.style,
]}
/>
);
});
const styles = StyleSheet.create({
input: {
borderWidth: 1,
fontSize: 13,
flexGrow: 1,
flexShrink: 1,
padding: 4,
},
});
export default ExampleTextInput;