Skip to content
Permalink
Browse files
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
  • Loading branch information
vonovak authored and facebook-github-bot committed Mar 4, 2020
1 parent 5834767 commit 884c86ae02b0be7ea1e4b258dab39f4c5aee0b9d
Showing 1 changed file with 1 addition and 1 deletion.
@@ -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.

0 comments on commit 884c86a

Please sign in to comment.