Bluesky app fork with some witchin' additions 馃挮
at main 2.7 kB view raw
1diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h 2index 914a249..0deac55 100644 3--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h 4+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h 5@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN 6 */ 7 @interface RCTPullToRefreshViewComponentView : RCTViewComponentView <RCTCustomPullToRefreshViewProtocol> 8 9+- (void)beginRefreshingProgrammatically; 10+ 11 @end 12 13 NS_ASSUME_NONNULL_END 14diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h 15index 5fbb2e0..ec5f58c 100644 16--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h 17+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h 18@@ -17,4 +17,6 @@ 19 @property (nonatomic, weak) UIScrollView *scrollView; 20 @property (nonatomic, copy) UIColor *customTintColor; 21 22+- (void)forwarderBeginRefreshing; 23+ 24 @end 25diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m 26index e2e0c9f..ff1b1ed 100644 27--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m 28+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m 29@@ -240,4 +240,38 @@ - (void)setTintColor:(UIColor *)tintColor 30 } 31 } 32 33+// This method is used by Bluesky's ExpoScrollForwarder. This allows other React Native 34+// libraries to perform a refresh of a scrollview and access the refresh control's onRefresh 35+// function. 36+- (void)forwarderBeginRefreshing 37+{ 38+ _refreshingProgrammatically = NO; 39+ 40+ [self sizeToFit]; 41+ 42+ if (!self.scrollView) { 43+ return; 44+ } 45+ 46+ UIScrollView *scrollView = (UIScrollView *)self.scrollView; 47+ 48+ [UIView animateWithDuration:0.3 49+ delay:0 50+ options:UIViewAnimationOptionBeginFromCurrentState 51+ animations:^(void) { 52+ // Whenever we call this method, the scrollview will always be at a position of 53+ // -130 or less. Scrolling back to -65 simulates the default behavior of RCTRefreshControl 54+ [scrollView setContentOffset:CGPointMake(0, -65)]; 55+ } 56+ completion:^(__unused BOOL finished) { 57+ [super beginRefreshing]; 58+ [self setCurrentRefreshingState:super.refreshing]; 59+ 60+ if (self->_onRefresh) { 61+ self->_onRefresh(nil); 62+ } 63+ } 64+ ]; 65+} 66+ 67 @end