Skip to content

Commit ac84d9a

Browse files
committed
resolve or remove unneeded unused-promise annotations
1 parent 660a636 commit ac84d9a

File tree

9 files changed

+13
-27
lines changed

9 files changed

+13
-27
lines changed

packages/react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid.android.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ class DrawerLayoutAndroid
150150
* LTI update could not be added via codemod */
151151
_onDrawerSlide = event => {
152152
if (this.props.onDrawerSlide) {
153-
// $FlowFixMe[unused-promise]
154153
this.props.onDrawerSlide(event);
155154
}
156155
if (this.props.keyboardDismissMode === 'on-drag') {

packages/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,12 @@ class KeyboardAvoidingView extends React.Component<
112112

113113
_onKeyboardChange = (event: ?KeyboardEvent) => {
114114
this._keyboardEvent = event;
115-
// $FlowFixMe[unused-promise]
116-
this._updateBottomIfNecessary();
115+
void this._updateBottomIfNecessary();
117116
};
118117

119118
_onKeyboardHide = (event: ?KeyboardEvent) => {
120119
this._keyboardEvent = null;
121-
// $FlowFixMe[unused-promise]
122-
this._updateBottomIfNecessary();
120+
void this._updateBottomIfNecessary();
123121
};
124122

125123
_onLayout = async (event: ViewLayoutEvent) => {

packages/react-native/Libraries/Components/RefreshControl/RefreshControl.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,7 @@ class RefreshControl extends React.Component<RefreshControlProps> {
186186
_onRefresh = () => {
187187
this._lastNativeRefreshing = true;
188188

189-
// $FlowFixMe[unused-promise]
190-
this.props.onRefresh && this.props.onRefresh();
189+
this.props.onRefresh && void this.props.onRefresh();
191190

192191
// The native component will start refreshing so force an update to
193192
// make sure it stays in sync with the js component.

packages/react-native/Libraries/Components/Switch/Switch.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,8 @@ const Switch: component(
199199
const [native, setNative] = useState({value: (null: ?boolean)});
200200

201201
const handleChange = (event: SwitchChangeEvent) => {
202-
// $FlowFixMe[unused-promise]
203-
onChange?.(event);
204-
// $FlowFixMe[unused-promise]
205-
onValueChange?.(event.nativeEvent.value);
202+
void onChange?.(event);
203+
void onValueChange?.(event.nativeEvent.value);
206204
setNative({value: event.nativeEvent.value});
207205
};
208206

packages/react-native/Libraries/Core/Devtools/openFileInEditor.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
const getDevServer = require('./getDevServer').default;
1414

1515
export default function openFileInEditor(file: string, lineNumber: number) {
16-
// $FlowFixMe[unused-promise]
17-
fetch(getDevServer().url + 'open-stack-frame', {
16+
void fetch(getDevServer().url + 'open-stack-frame', {
1817
method: 'POST',
1918
headers: {
2019
'Content-Type': 'application/json',

packages/react-native/Libraries/Core/Devtools/openURLInBrowser.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
const getDevServer = require('./getDevServer').default;
1414

1515
export default function openURLInBrowser(url: string) {
16-
// $FlowFixMe[unused-promise]
17-
fetch(getDevServer().url + 'open-url', {
16+
void fetch(getDevServer().url + 'open-url', {
1817
method: 'POST',
1918
headers: {
2019
'Content-Type': 'application/json',

packages/react-native/Libraries/LogBox/Data/__tests__/LogBoxSymbolication-test.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,16 @@ describe('LogBoxSymbolication', () => {
4040
});
4141

4242
it('symbolicates different stacks', () => {
43-
// $FlowFixMe[unused-promise]
44-
LogBoxSymbolication.symbolicate(createStack(['A', 'B', 'C']));
45-
// $FlowFixMe[unused-promise]
46-
LogBoxSymbolication.symbolicate(createStack(['D', 'E', 'F']));
43+
void LogBoxSymbolication.symbolicate(createStack(['A', 'B', 'C']));
44+
void LogBoxSymbolication.symbolicate(createStack(['D', 'E', 'F']));
4745

4846
expect(symbolicateStackTrace.mock.calls.length).toBe(2);
4947
});
5048

5149
it('batch symbolicates equivalent stacks', () => {
5250
const stack = createStack(['A', 'B', 'C']);
53-
// $FlowFixMe[unused-promise]
54-
LogBoxSymbolication.symbolicate(stack);
55-
// $FlowFixMe[unused-promise]
56-
LogBoxSymbolication.symbolicate(stack);
51+
void LogBoxSymbolication.symbolicate(stack);
52+
void LogBoxSymbolication.symbolicate(stack);
5753

5854
expect(symbolicateStackTrace.mock.calls.length).toBe(1);
5955
});

packages/react-native/Libraries/LogBox/UI/LogBoxMessage.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ function TappableLinks(props: {
7676
fragments.push(
7777
<Text
7878
onPress={() => {
79-
// $FlowFixMe[unused-promise]
80-
Linking.openURL(link);
79+
void Linking.openURL(link);
8180
}}
8281
key={++indexCounter}
8382
style={styles.linkText}>

packages/react-native/Libraries/ReactNative/AppRegistryImpl.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,7 @@ export function startHeadlessTask(
281281
NativeHeadlessJsTaskSupport &&
282282
reason instanceof HeadlessJsTaskError
283283
) {
284-
// $FlowFixMe[unused-promise]
285-
NativeHeadlessJsTaskSupport.notifyTaskRetry(taskId).then(
284+
void NativeHeadlessJsTaskSupport.notifyTaskRetry(taskId).then(
286285
retryPosted => {
287286
if (!retryPosted) {
288287
NativeHeadlessJsTaskSupport.notifyTaskFinished(taskId);

0 commit comments

Comments
 (0)