Skip to content

Commit c5a26be

Browse files
Saadnajmiclaude
andcommitted
chore: remove RNTesterPlayground test case and UIView+React TODO comment
Removes the RNTesterPlayground interactive test and the commented-out Paper blur fix to keep the PR focused on Fabric TextInput command fixes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent cc8ddb6 commit c5a26be

3 files changed

Lines changed: 9 additions & 170 deletions

File tree

packages/react-native/Libraries/Components/TextInput/__tests__/TextInput-test.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ jest.unmock('../TextInput');
6565

6666
expect(inputElement.isFocused).toBeInstanceOf(Function); // Would have prevented S168585
6767
expect(inputElement.clear).toBeInstanceOf(Function);
68+
// [macOS
6869
expect(inputElement.setSelection).toBeInstanceOf(Function);
69-
expect(inputElement.setGhostText).toBeInstanceOf(Function); // [macOS]
70+
expect(inputElement.setGhostText).toBeInstanceOf(Function);
71+
// macOS]
7072
// $FlowFixMe[method-unbinding]
7173
expect(inputElement.focus).toBeInstanceOf(jest.fn().constructor);
7274
// $FlowFixMe[method-unbinding]

packages/react-native/React/Views/UIView+React.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,6 @@ - (void)reactBlur
397397
#if !TARGET_OS_OSX // [macOS]
398398
[self resignFirstResponder];
399399
#else // [macOS
400-
// TODO: Fix blur for NSTextField (field editor mismatch) - uncomment after testing Fabric fix
401-
// When an NSTextField is focused, the window's firstResponder is the field editor
402-
// (an NSTextView), not the text field itself. Use currentEditor to check if focused.
403-
// if ([self isKindOfClass:[NSTextField class]] && [(NSTextField *)self currentEditor] != nil) {
404-
// [[self window] makeFirstResponder:nil];
405-
// } else if (self == [[self window] firstResponder]) {
406-
// [[self window] makeFirstResponder:nil];
407-
// }
408400
if (self == [[self window] firstResponder]) {
409401
[[self window] makeFirstResponder:[[self window] nextResponder]];
410402
}

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

Lines changed: 6 additions & 161 deletions
Original file line numberDiff line numberDiff line change
@@ -12,182 +12,27 @@ import type {RNTesterModuleExample} from '../../types/RNTesterTypes';
1212

1313
import RNTesterText from '../../components/RNTesterText';
1414
import * as React from 'react';
15-
import {
16-
Button,
17-
Platform,
18-
ScrollView,
19-
StyleSheet,
20-
TextInput,
21-
View,
22-
} from 'react-native';
15+
import {StyleSheet, View} from 'react-native';
2316

2417
function Playground() {
25-
const textInputRef = React.useRef<React.ElementRef<typeof TextInput> | null>(
26-
null,
27-
);
28-
const [refStatus, setRefStatus] = React.useState<string>('pending...');
29-
const [log, setLog] = React.useState<string>('');
30-
31-
React.useEffect(() => {
32-
const status =
33-
textInputRef.current != null ? 'REF OK' : 'REF IS NULL';
34-
setRefStatus(status);
35-
}, []);
36-
37-
const appendLog = React.useCallback((message: string) => {
38-
setLog(prev => (prev ? prev + '\n' : '') + message);
39-
}, []);
40-
41-
const runCommand = React.useCallback(
42-
(name: string, fn: (ref: React.ElementRef<typeof TextInput>) => void) => {
43-
try {
44-
if (textInputRef.current == null) {
45-
appendLog(`${name}: FAILED - ref is null`);
46-
return;
47-
}
48-
fn(textInputRef.current);
49-
appendLog(`${name}: OK`);
50-
} catch (e: mixed) {
51-
const message = e instanceof Error ? e.message : String(e);
52-
appendLog(`${name}: ERROR - ${message}`);
53-
}
54-
},
55-
[appendLog],
56-
);
57-
5818
return (
59-
<ScrollView style={styles.container}>
60-
<RNTesterText style={styles.header}>
61-
TextInput Ref & Commands Test
19+
<View style={styles.container}>
20+
<RNTesterText>
21+
Edit "RNTesterPlayground.js" to change this file
6222
</RNTesterText>
63-
64-
<RNTesterText style={styles.status}>
65-
Ref status: {refStatus}
66-
</RNTesterText>
67-
68-
<TextInput
69-
ref={textInputRef}
70-
style={styles.textInput}
71-
defaultValue="Hello World TextInput"
72-
multiline={false}
73-
/>
74-
75-
<View style={styles.buttonRow}>
76-
<Button
77-
title="Focus"
78-
onPress={() => runCommand('focus', ref => ref.focus())}
79-
/>
80-
<Button
81-
title="Blur"
82-
onPress={() => runCommand('blur', ref => ref.blur())}
83-
/>
84-
<Button
85-
title="Clear"
86-
onPress={() => runCommand('clear', ref => ref.clear())}
87-
/>
88-
</View>
89-
90-
<View style={styles.buttonRow}>
91-
<Button
92-
title="Set Selection (0, 5)"
93-
onPress={() =>
94-
runCommand('setSelection(0,5)', ref => ref.setSelection(0, 5))
95-
}
96-
/>
97-
<Button
98-
title="isFocused?"
99-
onPress={() =>
100-
runCommand('isFocused', ref =>
101-
appendLog(` -> isFocused: ${String(ref.isFocused())}`),
102-
)
103-
}
104-
/>
105-
</View>
106-
107-
{Platform.OS === 'macos' ? (
108-
<View style={styles.buttonRow}>
109-
<Button
110-
title="Set Ghost Text"
111-
onPress={() =>
112-
runCommand('setGhostText', ref =>
113-
// $FlowFixMe[prop-missing]
114-
ref.setGhostText('ghost suggestion'),
115-
)
116-
}
117-
/>
118-
<Button
119-
title="Clear Ghost Text"
120-
onPress={() =>
121-
// $FlowFixMe[prop-missing]
122-
runCommand('clearGhostText', ref => ref.setGhostText(null))
123-
}
124-
/>
125-
</View>
126-
) : null}
127-
128-
<Button title="Clear Log" onPress={() => setLog('')} />
129-
130-
<RNTesterText style={styles.logHeader}>Log:</RNTesterText>
131-
<View style={styles.logContainer}>
132-
<RNTesterText style={styles.logText}>
133-
{log || '(no commands run yet)'}
134-
</RNTesterText>
135-
</View>
136-
</ScrollView>
23+
</View>
13724
);
13825
}
13926

14027
const styles = StyleSheet.create({
14128
container: {
14229
padding: 10,
14330
},
144-
header: {
145-
fontSize: 16,
146-
fontWeight: 'bold',
147-
marginBottom: 10,
148-
},
149-
status: {
150-
fontSize: 14,
151-
fontWeight: 'bold',
152-
marginBottom: 8,
153-
},
154-
textInput: {
155-
height: 40,
156-
borderColor: '#999',
157-
borderWidth: 1,
158-
borderRadius: 4,
159-
paddingHorizontal: 8,
160-
marginBottom: 10,
161-
fontSize: 14,
162-
},
163-
buttonRow: {
164-
flexDirection: 'row',
165-
flexWrap: 'wrap',
166-
gap: 8,
167-
marginBottom: 8,
168-
},
169-
logHeader: {
170-
fontSize: 12,
171-
fontWeight: 'bold',
172-
marginTop: 10,
173-
marginBottom: 4,
174-
},
175-
logContainer: {
176-
backgroundColor: '#f0f0f0',
177-
borderRadius: 4,
178-
padding: 8,
179-
minHeight: 60,
180-
},
181-
logText: {
182-
fontSize: 11,
183-
fontFamily: Platform.OS === 'macos' ? 'Menlo' : 'monospace',
184-
},
18531
});
18632

18733
export default ({
18834
title: 'Playground',
18935
name: 'playground',
190-
description:
191-
'TextInput ref and commands verification test for macOS Fabric.',
36+
description: 'Test out new features and ideas.',
19237
render: (): React.Node => <Playground />,
19338
}: RNTesterModuleExample);

0 commit comments

Comments
 (0)