split up existing patch into 3
This commit is contained in:
@@ -1,47 +1,16 @@
|
|||||||
diff --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
|
|
||||||
index 914a249..0deac55 100644
|
|
||||||
--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h
|
|
||||||
+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h
|
|
||||||
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
||||||
*/
|
|
||||||
@interface RCTPullToRefreshViewComponentView : RCTViewComponentView <RCTCustomPullToRefreshViewProtocol>
|
|
||||||
|
|
||||||
+- (void)beginRefreshingProgrammatically;
|
|
||||||
+
|
|
||||||
@end
|
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
|
||||||
diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
|
|
||||||
index d029337..0f63ea3 100644
|
|
||||||
--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
|
|
||||||
+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
|
|
||||||
@@ -1038,6 +1038,11 @@ - (void)_adjustForMaintainVisibleContentPosition
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
++ (BOOL)shouldBeRecycled
|
|
||||||
+{
|
|
||||||
+ return NO;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
@end
|
|
||||||
|
|
||||||
Class<RCTComponentViewProtocol> RCTScrollViewCls(void)
|
|
||||||
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
||||||
index e9b330f..ec5f58c 100644
|
index e9b330f..5fbb2e0 100644
|
||||||
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
||||||
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
||||||
@@ -15,5 +15,8 @@
|
@@ -15,5 +15,6 @@
|
||||||
@property (nonatomic, copy) NSString *title;
|
@property (nonatomic, copy) NSString *title;
|
||||||
@property (nonatomic, copy) RCTDirectEventBlock onRefresh;
|
@property (nonatomic, copy) RCTDirectEventBlock onRefresh;
|
||||||
@property (nonatomic, weak) UIScrollView *scrollView;
|
@property (nonatomic, weak) UIScrollView *scrollView;
|
||||||
+@property (nonatomic, copy) UIColor *customTintColor;
|
+@property (nonatomic, copy) UIColor *customTintColor;
|
||||||
+
|
|
||||||
+- (void)forwarderBeginRefreshing;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
index 53bfd04..ff1b1ed 100644
|
index 53bfd04..e2e0c9f 100644
|
||||||
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
@@ -23,6 +23,7 @@ @implementation RCTRefreshControl {
|
@@ -23,6 +23,7 @@ @implementation RCTRefreshControl {
|
||||||
@@ -65,7 +34,7 @@ index 53bfd04..ff1b1ed 100644
|
|||||||
- (void)didMoveToWindow
|
- (void)didMoveToWindow
|
||||||
{
|
{
|
||||||
[super didMoveToWindow];
|
[super didMoveToWindow];
|
||||||
@@ -221,4 +228,50 @@ - (void)refreshControlValueChanged
|
@@ -221,4 +228,16 @@ - (void)refreshControlValueChanged
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,40 +49,6 @@ index 53bfd04..ff1b1ed 100644
|
|||||||
+ [super setTintColor:tintColor];
|
+ [super setTintColor:tintColor];
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
|
||||||
+// This method is used by Bluesky's ExpoScrollForwarder. This allows other React Native
|
|
||||||
+// libraries to perform a refresh of a scrollview and access the refresh control's onRefresh
|
|
||||||
+// function.
|
|
||||||
+- (void)forwarderBeginRefreshing
|
|
||||||
+{
|
|
||||||
+ _refreshingProgrammatically = NO;
|
|
||||||
+
|
|
||||||
+ [self sizeToFit];
|
|
||||||
+
|
|
||||||
+ if (!self.scrollView) {
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ UIScrollView *scrollView = (UIScrollView *)self.scrollView;
|
|
||||||
+
|
|
||||||
+ [UIView animateWithDuration:0.3
|
|
||||||
+ delay:0
|
|
||||||
+ options:UIViewAnimationOptionBeginFromCurrentState
|
|
||||||
+ animations:^(void) {
|
|
||||||
+ // Whenever we call this method, the scrollview will always be at a position of
|
|
||||||
+ // -130 or less. Scrolling back to -65 simulates the default behavior of RCTRefreshControl
|
|
||||||
+ [scrollView setContentOffset:CGPointMake(0, -65)];
|
|
||||||
+ }
|
|
||||||
+ completion:^(__unused BOOL finished) {
|
|
||||||
+ [super beginRefreshing];
|
|
||||||
+ [self setCurrentRefreshingState:super.refreshing];
|
|
||||||
+
|
|
||||||
+ if (self->_onRefresh) {
|
|
||||||
+ self->_onRefresh(nil);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ ];
|
|
||||||
+}
|
|
||||||
+
|
+
|
||||||
@end
|
@end
|
||||||
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m
|
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
diff --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
|
||||||
|
index 914a249..0deac55 100644
|
||||||
|
--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h
|
||||||
|
+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTPullToRefreshViewComponentView.h
|
||||||
|
@@ -19,6 +19,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
|
*/
|
||||||
|
@interface RCTPullToRefreshViewComponentView : RCTViewComponentView <RCTCustomPullToRefreshViewProtocol>
|
||||||
|
|
||||||
|
+- (void)beginRefreshingProgrammatically;
|
||||||
|
+
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
|
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
||||||
|
index 5fbb2e0..ec5f58c 100644
|
||||||
|
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
||||||
|
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h
|
||||||
|
@@ -17,4 +17,6 @@
|
||||||
|
@property (nonatomic, weak) UIScrollView *scrollView;
|
||||||
|
@property (nonatomic, copy) UIColor *customTintColor;
|
||||||
|
|
||||||
|
+- (void)forwarderBeginRefreshing;
|
||||||
|
+
|
||||||
|
@end
|
||||||
|
diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
|
index e2e0c9f..ff1b1ed 100644
|
||||||
|
--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
|
+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m
|
||||||
|
@@ -240,4 +240,38 @@ - (void)setTintColor:(UIColor *)tintColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+// This method is used by Bluesky's ExpoScrollForwarder. This allows other React Native
|
||||||
|
+// libraries to perform a refresh of a scrollview and access the refresh control's onRefresh
|
||||||
|
+// function.
|
||||||
|
+- (void)forwarderBeginRefreshing
|
||||||
|
+{
|
||||||
|
+ _refreshingProgrammatically = NO;
|
||||||
|
+
|
||||||
|
+ [self sizeToFit];
|
||||||
|
+
|
||||||
|
+ if (!self.scrollView) {
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ UIScrollView *scrollView = (UIScrollView *)self.scrollView;
|
||||||
|
+
|
||||||
|
+ [UIView animateWithDuration:0.3
|
||||||
|
+ delay:0
|
||||||
|
+ options:UIViewAnimationOptionBeginFromCurrentState
|
||||||
|
+ animations:^(void) {
|
||||||
|
+ // Whenever we call this method, the scrollview will always be at a position of
|
||||||
|
+ // -130 or less. Scrolling back to -65 simulates the default behavior of RCTRefreshControl
|
||||||
|
+ [scrollView setContentOffset:CGPointMake(0, -65)];
|
||||||
|
+ }
|
||||||
|
+ completion:^(__unused BOOL finished) {
|
||||||
|
+ [super beginRefreshing];
|
||||||
|
+ [self setCurrentRefreshingState:super.refreshing];
|
||||||
|
+
|
||||||
|
+ if (self->_onRefresh) {
|
||||||
|
+ self->_onRefresh(nil);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ ];
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
@end
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
|
||||||
|
index d029337..0f63ea3 100644
|
||||||
|
--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
|
||||||
|
+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm
|
||||||
|
@@ -1038,6 +1038,11 @@ - (void)_adjustForMaintainVisibleContentPosition
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
++ (BOOL)shouldBeRecycled
|
||||||
|
+{
|
||||||
|
+ return NO;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
@end
|
||||||
|
|
||||||
|
Class<RCTComponentViewProtocol> RCTScrollViewCls(void)
|
||||||
Reference in New Issue
Block a user