Skip to content

Commit 884c86a

Browse files
vonovakfacebook-github-bot
authored andcommitted
change onRefresh flow typing (#28167)
Summary: I propose this change because we (and a lot of other people, I'd guess) pass an `async` function as a parameter to `onRefresh`. Because the `async` function returns a `promise`, flow is reporting an error. I think the type checking here can be relaxed either all the way to `any` (because RN does not care here what we return) or to `void | Promise<void>` to account for async functions. looking at fb7b2d3#diff-a9c5687ae65236ba3e7f34bfdcdec81d seems like the second is preferred ## Changelog [General] [changed] - relax RefreshControl's onRefresh flow typing Pull Request resolved: #28167 Test Plan: * flow passes Reviewed By: hramos Differential Revision: D20196529 Pulled By: TheSavior fbshipit-source-id: bb5a314bcfb5fb9c8ab71eccb449f1322aeebacb
1 parent 5834767 commit 884c86a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Libraries/Components/RefreshControl/RefreshControl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export type RefreshControlProps = $ReadOnly<{|
8383
/**
8484
* Called when the view starts refreshing.
8585
*/
86-
onRefresh?: ?() => void,
86+
onRefresh?: ?() => void | Promise<void>,
8787

8888
/**
8989
* Whether the view should be indicating an active refresh.

0 commit comments

Comments
 (0)