Fix RefreshControl layout when removed from window (#31024)
Fix RefreshControl layout when removed from window (#31024)

Summary:
Since iOS 14 refresh control is sometimes visible when it shouldn't. It seems to happen when it is removed and added back to the window. This repros easily when using react-native-screens with react-navigation tabs. Inactive tabs are detached from the window to save resources.

Calling endRefreshing when refresh control is added to the window fixes the layout. It will also be called on first mount where it is not necessary, but should be a no-op and didn't cause any issues. I also decided to call it for all ios versions, although it is only needed on iOS 14+ to avoid forking behavior more.

## Changelog

[iOS] [Fixed] - Fix RefreshControl layout when removed from window

Pull Request resolved: https://github.com/facebook/react-native/pull/31024

Test Plan:
Before:

https://user-images.githubusercontent.com/2677334/108666197-93ea5a80-74a4-11eb-839b-8a4916967bf8.mov

After:

https://user-images.githubusercontent.com/2677334/108666223-9ea4ef80-74a4-11eb-8489-4e5d257299c8.mov

Reviewed By: shergin

Differential Revision: D26590759

Pulled By: PeteTheHeat

fbshipit-source-id: b8c06068a24446b261cbeb88ff166289724031f1

javache/react-native,pandiaraj44/react-native,myntra/react-native,janicduplessis/react-native,myntra/react-native,pandiaraj44/react-native,javache/react-native,facebook/react-native,javache/react-native,myntra/react-native,arthuralee/react-native,javache/react-native,myntra/react-native,janicduplessis/react-native,janicduplessis/react-native,pandiaraj44/react-native,arthuralee/react-native,pandiaraj44/react-native,janicduplessis/react-native,facebook/react-native,javache/react-native,javache/react-native,javache/react-native,pandiaraj44/react-native,janicduplessis/react-native,arthuralee/react-native,myntra/react-native,janicduplessis/react-native,facebook/react-native,janicduplessis/react-native,arthuralee/react-native,facebook/react-native,myntra/react-native,facebook/react-native,arthuralee/react-native,pandiaraj44/react-native,javache/react-native,javache/react-native,facebook/react-native,pandiaraj44/react-native,myntra/react-native,myntra/react-native,facebook/react-native,janicduplessis/react-native,pandiaraj44/react-native,myntra/react-native,facebook/react-native,facebook/react-native