Skip to content

Commit c32ef4d

Browse files
javachefacebook-github-bot
authored andcommitted
Remove accidental ref callback return values (#57849)
Summary: 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
1 parent a511dc2 commit c32ef4d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

packages/rn-tester/js/examples/TextInput/TextInputSharedExamples.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,9 @@ class SelectionExample extends React.Component<
563563
onChangeText={value => this.setState({value})}
564564
// $FlowFixMe[method-unbinding] added when improving typing for this parameters
565565
onSelectionChange={this.onSelectionChange.bind(this)}
566-
ref={textInput => (this._textInput = textInput)}
566+
ref={textInput => {
567+
this._textInput = textInput;
568+
}}
567569
selection={this.props.imperative ? undefined : this.state.selection}
568570
style={this.props.style}
569571
value={this.state.value}

packages/rn-tester/js/examples/Timer/TimerExample.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,9 @@ class IntervalExample extends React.Component<
297297
return (
298298
<View>
299299
<TimerTester
300-
ref={ref => (this._timerTester = ref)}
300+
ref={ref => {
301+
this._timerTester = ref;
302+
}}
301303
dt={25}
302304
type="setInterval"
303305
/>

0 commit comments

Comments
 (0)