Skip to content

Commit fa68e7d

Browse files
committed
Reproducer for #60013: single-line TextInput loses nested Text styles after a text size change
1 parent 9a4ef4d commit fa68e7d

1 file changed

Lines changed: 36 additions & 2 deletions

File tree

‎packages/rn-tester/js/examples/Playground/RNTesterPlayground.js‎

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,56 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
1212

1313
import RNTesterText from '../../components/RNTesterText';
1414
import * as React from 'react';
15-
import {StyleSheet, View} from 'react-native';
15+
import {StyleSheet, Text, TextInput, View} from 'react-native';
1616

17+
// https://github.com/react/react-native/issues/60013
18+
// Change the OS text size while the app runs (Settings > Accessibility >
19+
// Display & Text Size > Larger Text, or
20+
// `xcrun simctl ui booted content_size accessibility-large`), then go back.
21+
// Expected: "word" stays red and in Courier in both inputs.
22+
// Actual on iOS: the single-line input draws all of its text in the default
23+
// color and font.
1724
function Playground() {
1825
return (
1926
<View style={styles.container}>
2027
<RNTesterText>
21-
Edit "RNTesterPlayground.js" to change this file
28+
Change the OS text size (Settings &gt; Accessibility &gt; Display &amp;
29+
Text Size &gt; Larger Text), then come back. &quot;word&quot; must stay
30+
red and in Courier in both inputs.
2231
</RNTesterText>
32+
<RNTesterText>Single-line</RNTesterText>
33+
<TextInput testID="playground-singleline" style={styles.input}>
34+
<Text>
35+
plain <Text style={styles.word}>word</Text> end
36+
</Text>
37+
</TextInput>
38+
<RNTesterText>Multiline</RNTesterText>
39+
<TextInput
40+
testID="playground-multiline"
41+
multiline={true}
42+
style={styles.input}>
43+
<Text>
44+
plain <Text style={styles.word}>word</Text> end
45+
</Text>
46+
</TextInput>
2347
</View>
2448
);
2549
}
2650

2751
const styles = StyleSheet.create({
2852
container: {
53+
gap: 12,
2954
padding: 10,
3055
},
56+
input: {
57+
borderWidth: 1,
58+
fontSize: 18,
59+
padding: 8,
60+
},
61+
word: {
62+
color: 'red',
63+
fontFamily: 'Courier',
64+
},
3165
});
3266

3367
export default {

0 commit comments

Comments
 (0)