Skip to content

Commit

Permalink
change onRefresh flow typing (#28167)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vonovak authored and facebook-github-bot committed Mar 4, 2020
1 parent 5834767 commit 884c86a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/Components/RefreshControl/RefreshControl.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type RefreshControlProps = $ReadOnly<{|
/**
* Called when the view starts refreshing.
*/
onRefresh?: ?() => void,
onRefresh?: ?() => void | Promise<void>,

/**
* Whether the view should be indicating an active refresh.
Expand Down

0 comments on commit 884c86a

Please sign in to comment.