Remove accidental ref callback return values (#57849)

Summary:
Pull Request resolved: https://github.com/react/react-native/pull/57849

Ref callbacks commonly used expression bodies that returned assignment or collection method results. Use block bodies so these callbacks return `void`, matching React's ref contract.

Changelog:
[Internal] - Make callback refs return `void` explicitly.

Reviewed By: SamChou19815

Differential Revision: D115064073

fbshipit-source-id: ad8fcdb1a94421a700e958c6e4ae981bf350d1ed
This commit is contained in:
Pieter De Baets authored and meta-codesync[bot] committed 2026-08-18 05:35:06 -07:00
1 parent 8ac3e2fa58
commit 2ce2c0794b
2 files changed
+6 -2

No files matched your search

@@ -563,7 +563,9 @@ class SelectionExample extends React.Component<
onChangeText={value => this.setState({value})}
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
onSelectionChange={this.onSelectionChange.bind(this)}
ref={textInput => (this._textInput = textInput)}
ref={textInput => {
this._textInput = textInput;
}}
selection={this.props.imperative ? undefined : this.state.selection}
style={this.props.style}
value={this.state.value}
@@ -297,7 +297,9 @@ class IntervalExample extends React.Component<
return (
<View>
<TimerTester
ref={ref => (this._timerTester = ref)}
ref={ref => {
this._timerTester = ref;
}}
dt={25}
type="setInterval"
/>