From 2ce2c0794b9e7550d1b62bf049860155a5244a31 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Tue, 18 Aug 2026 05:35:06 -0700 Subject: [PATCH] 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 --- .../js/examples/TextInput/TextInputSharedExamples.js | 4 +++- packages/rn-tester/js/examples/Timer/TimerExample.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js index 8f63ca66345..85c16b0a583 100644 --- a/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js +++ b/packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js @@ -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} diff --git a/packages/rn-tester/js/examples/Timer/TimerExample.js b/packages/rn-tester/js/examples/Timer/TimerExample.js index a80bdbac9f6..d9417d4c33b 100644 --- a/packages/rn-tester/js/examples/Timer/TimerExample.js +++ b/packages/rn-tester/js/examples/Timer/TimerExample.js @@ -297,7 +297,9 @@ class IntervalExample extends React.Component< return ( (this._timerTester = ref)} + ref={ref => { + this._timerTester = ref; + }} dt={25} type="setInterval" />