mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
at patch-version 366 lines 15 kB view raw
1diff --git a/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts b/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts 2index 62f52a7..ca30165 100644 3--- a/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts 4+++ b/node_modules/react-native/Libraries/StyleSheet/StyleSheetTypes.d.ts 5@@ -426,9 +426,10 @@ export interface ViewStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { 6 */ 7 pointerEvents?: 'box-none' | 'none' | 'box-only' | 'auto' | undefined; 8 isolation?: 'auto' | 'isolate' | undefined; 9- cursor?: CursorValue | undefined; 10+ cursor?: CursorValue | string | undefined; 11 boxShadow?: ReadonlyArray<BoxShadowValue> | string | undefined; 12 filter?: ReadonlyArray<FilterFunction> | string | undefined; 13+ transformOrigin?: string | (string | number)[] | undefined; 14 } 15 16 export type FontVariant = 17@@ -536,7 +537,11 @@ export interface TextStyle extends TextStyleIOS, TextStyleAndroid, ViewStyle { 18 textShadowOffset?: {width: number; height: number} | undefined; 19 textShadowRadius?: number | undefined; 20 textTransform?: 'none' | 'capitalize' | 'uppercase' | 'lowercase' | undefined; 21- userSelect?: 'auto' | 'none' | 'text' | 'contain' | 'all' | undefined; 22+ userSelect?: 'auto' | 'none' | 'text' | 'contain' | 'all' | string | undefined; 23+ cursor?: CursorValue | string | undefined; 24+ boxShadow?: ReadonlyArray<BoxShadowValue> | string | undefined; 25+ filter?: ReadonlyArray<FilterFunction> | string | undefined; 26+ transformOrigin?: string | (string | number)[] | undefined; 27 } 28 29 /** 30@@ -558,5 +563,8 @@ export interface ImageStyle extends FlexStyle, ShadowStyleIOS, TransformsStyle { 31 tintColor?: ColorValue | undefined; 32 opacity?: AnimatableNumericValue | undefined; 33 objectFit?: 'cover' | 'contain' | 'fill' | 'scale-down' | undefined; 34- cursor?: CursorValue | undefined; 35+ cursor?: CursorValue | string | undefined; 36+ boxShadow?: ReadonlyArray<BoxShadowValue> | string | undefined; 37+ filter?: ReadonlyArray<FilterFunction> | string | undefined; 38+ transformOrigin?: string | (string | number)[] | undefined; 39 } 40diff --git a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm 41index 93af874..106f8ec 100644 42--- a/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm 43+++ b/node_modules/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTEnhancedScrollView.mm 44@@ -66,28 +66,51 @@ - (void)preserveContentOffsetWithBlock:(void (^)())block 45 * ScrollView, we force it to be centered, but when you zoom or the content otherwise 46 * becomes larger than the ScrollView, there is no padding around the content but it 47 * can still fill the whole view. 48+ * This implementation is based on https://petersteinberger.com/blog/2013/how-to-center-uiscrollview/. 49 */ 50-- (void)setContentOffset:(CGPoint)contentOffset 51+-(void)centerContentIfNeeded 52 { 53- if (_isSetContentOffsetDisabled) { 54+ if (!_centerContent) { 55 return; 56 } 57 58- if (_centerContent && !CGSizeEqualToSize(self.contentSize, CGSizeZero)) { 59- CGSize scrollViewSize = self.bounds.size; 60- if (self.contentSize.width <= scrollViewSize.width) { 61- contentOffset.x = -(scrollViewSize.width - self.contentSize.width) / 2.0; 62- } 63- if (self.contentSize.height <= scrollViewSize.height) { 64- contentOffset.y = -(scrollViewSize.height - self.contentSize.height) / 2.0; 65- } 66+ CGSize contentSize = self.contentSize; 67+ CGSize boundsSize = self.bounds.size; 68+ if (CGSizeEqualToSize(contentSize, CGSizeZero) || 69+ CGSizeEqualToSize(boundsSize, CGSizeZero)) { 70+ return; 71 } 72 73+ CGFloat top = 0, left = 0; 74+ if (contentSize.width < boundsSize.width) { 75+ left = (boundsSize.width - contentSize.width) * 0.5f; 76+ } 77+ if (contentSize.height < boundsSize.height) { 78+ top = (boundsSize.height - contentSize.height) * 0.5f; 79+ } 80+ self.contentInset = UIEdgeInsetsMake(top, left, top, left); 81+} 82+ 83+- (void)setContentOffset:(CGPoint)contentOffset 84+{ 85+ if (_isSetContentOffsetDisabled) { 86+ return; 87+ } 88 super.contentOffset = CGPointMake( 89 RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), 90 RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); 91 } 92 93+- (void)setFrame:(CGRect)frame { 94+ [super setFrame:frame]; 95+ [self centerContentIfNeeded]; 96+} 97+ 98+- (void)didAddSubview:(UIView *)subview { 99+ [super didAddSubview:subview]; 100+ [self centerContentIfNeeded]; 101+} 102+ 103 - (BOOL)touchesShouldCancelInContentView:(UIView *)view 104 { 105 if ([_overridingDelegate respondsToSelector:@selector(touchesShouldCancelInContentView:)]) { 106@@ -257,6 +280,10 @@ - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView 107 } 108 } 109 110+- (void)scrollViewDidZoom:(__unused UIScrollView *)scrollView { 111+ [self centerContentIfNeeded]; 112+} 113+ 114 #pragma mark - 115 116 - (BOOL)isHorizontal:(UIScrollView *)scrollView 117diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h 118index e9b330f..ec5f58c 100644 119--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h 120+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.h 121@@ -15,5 +15,8 @@ 122 @property (nonatomic, copy) NSString *title; 123 @property (nonatomic, copy) RCTDirectEventBlock onRefresh; 124 @property (nonatomic, weak) UIScrollView *scrollView; 125+@property (nonatomic, copy) UIColor *customTintColor; 126+ 127+- (void)forwarderBeginRefreshing; 128 129 @end 130diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m 131index 53bfd04..ff1b1ed 100644 132--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m 133+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControl.m 134@@ -23,6 +23,7 @@ @implementation RCTRefreshControl { 135 UIColor *_titleColor; 136 CGFloat _progressViewOffset; 137 BOOL _hasMovedToWindow; 138+ UIColor *_customTintColor; 139 } 140 141 - (instancetype)init 142@@ -58,6 +59,12 @@ - (void)layoutSubviews 143 _isInitialRender = false; 144 } 145 146+- (void)didMoveToSuperview 147+{ 148+ [super didMoveToSuperview]; 149+ [self setTintColor:_customTintColor]; 150+} 151+ 152 - (void)didMoveToWindow 153 { 154 [super didMoveToWindow]; 155@@ -221,4 +228,50 @@ - (void)refreshControlValueChanged 156 } 157 } 158 159+// Fix for https://github.com/facebook/react-native/issues/43388 160+// A bug in iOS 17.4 causes the haptic to not play when refreshing if the tintColor 161+// is set before the refresh control gets added to the scrollview. We'll call this 162+// function whenever the superview changes. We'll also call it if the value of customTintColor 163+// changes. 164+- (void)setTintColor:(UIColor *)tintColor 165+{ 166+ if ([self.superview isKindOfClass:[UIScrollView class]] && self.tintColor != tintColor) { 167+ [super setTintColor:tintColor]; 168+ } 169+} 170+ 171+// This method is used by Bluesky's ExpoScrollForwarder. This allows other React Native 172+// libraries to perform a refresh of a scrollview and access the refresh control's onRefresh 173+// function. 174+- (void)forwarderBeginRefreshing 175+{ 176+ _refreshingProgrammatically = NO; 177+ 178+ [self sizeToFit]; 179+ 180+ if (!self.scrollView) { 181+ return; 182+ } 183+ 184+ UIScrollView *scrollView = (UIScrollView *)self.scrollView; 185+ 186+ [UIView animateWithDuration:0.3 187+ delay:0 188+ options:UIViewAnimationOptionBeginFromCurrentState 189+ animations:^(void) { 190+ // Whenever we call this method, the scrollview will always be at a position of 191+ // -130 or less. Scrolling back to -65 simulates the default behavior of RCTRefreshControl 192+ [scrollView setContentOffset:CGPointMake(0, -65)]; 193+ } 194+ completion:^(__unused BOOL finished) { 195+ [super beginRefreshing]; 196+ [self setCurrentRefreshingState:super.refreshing]; 197+ 198+ if (self->_onRefresh) { 199+ self->_onRefresh(nil); 200+ } 201+ } 202+ ]; 203+} 204+ 205 @end 206diff --git a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m 207index 40aaf9c..1c60164 100644 208--- a/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m 209+++ b/node_modules/react-native/React/Views/RefreshControl/RCTRefreshControlManager.m 210@@ -22,11 +22,12 @@ - (UIView *)view 211 212 RCT_EXPORT_VIEW_PROPERTY(onRefresh, RCTDirectEventBlock) 213 RCT_EXPORT_VIEW_PROPERTY(refreshing, BOOL) 214-RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) 215 RCT_EXPORT_VIEW_PROPERTY(title, NSString) 216 RCT_EXPORT_VIEW_PROPERTY(titleColor, UIColor) 217 RCT_EXPORT_VIEW_PROPERTY(progressViewOffset, CGFloat) 218 219+RCT_REMAP_VIEW_PROPERTY(tintColor, customTintColor, UIColor) 220+ 221 RCT_EXPORT_METHOD(setNativeRefreshing : (nonnull NSNumber *)viewTag toRefreshing : (BOOL)refreshing) 222 { 223 [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) { 224diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m 225index e9ce48c..84a6fca 100644 226--- a/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m 227+++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollView.m 228@@ -159,26 +159,8 @@ - (BOOL)touchesShouldCancelInContentView:(__unused UIView *)view 229 return !shouldDisableScrollInteraction; 230 } 231 232-/* 233- * Automatically centers the content such that if the content is smaller than the 234- * ScrollView, we force it to be centered, but when you zoom or the content otherwise 235- * becomes larger than the ScrollView, there is no padding around the content but it 236- * can still fill the whole view. 237- */ 238 - (void)setContentOffset:(CGPoint)contentOffset 239 { 240- UIView *contentView = [self contentView]; 241- if (contentView && _centerContent && !CGSizeEqualToSize(contentView.frame.size, CGSizeZero)) { 242- CGSize subviewSize = contentView.frame.size; 243- CGSize scrollViewSize = self.bounds.size; 244- if (subviewSize.width <= scrollViewSize.width) { 245- contentOffset.x = -(scrollViewSize.width - subviewSize.width) / 2.0; 246- } 247- if (subviewSize.height <= scrollViewSize.height) { 248- contentOffset.y = -(scrollViewSize.height - subviewSize.height) / 2.0; 249- } 250- } 251- 252 super.contentOffset = CGPointMake( 253 RCTSanitizeNaNValue(contentOffset.x, @"scrollView.contentOffset.x"), 254 RCTSanitizeNaNValue(contentOffset.y, @"scrollView.contentOffset.y")); 255@@ -427,6 +409,11 @@ - (void)setRemoveClippedSubviews:(__unused BOOL)removeClippedSubviews 256 // Does nothing 257 } 258 259+- (void)setFrame:(CGRect)frame { 260+ [super setFrame:frame]; 261+ [self centerContentIfNeeded]; 262+} 263+ 264 - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex 265 { 266 [super insertReactSubview:view atIndex:atIndex]; 267@@ -443,6 +430,8 @@ - (void)insertReactSubview:(UIView *)view atIndex:(NSInteger)atIndex 268 _contentView = view; 269 RCTApplyTransformationAccordingLayoutDirection(_contentView, self.reactLayoutDirection); 270 [_scrollView addSubview:view]; 271+ 272+ [self centerContentIfNeeded]; 273 } 274 } 275 276@@ -652,9 +641,46 @@ -(void)delegateMethod : (UIScrollView *)scrollView \ 277 } 278 279 RCT_SCROLL_EVENT_HANDLER(scrollViewWillBeginDecelerating, onMomentumScrollBegin) 280-RCT_SCROLL_EVENT_HANDLER(scrollViewDidZoom, onScroll) 281 RCT_SCROLL_EVENT_HANDLER(scrollViewDidScrollToTop, onScrollToTop) 282 283+-(void)scrollViewDidZoom : (UIScrollView *)scrollView 284+{ 285+ [self centerContentIfNeeded]; 286+ 287+ RCT_SEND_SCROLL_EVENT(onScroll, nil); 288+ RCT_FORWARD_SCROLL_EVENT(scrollViewDidZoom : scrollView); 289+} 290+ 291+/* 292+ * Automatically centers the content such that if the content is smaller than the 293+ * ScrollView, we force it to be centered, but when you zoom or the content otherwise 294+ * becomes larger than the ScrollView, there is no padding around the content but it 295+ * can still fill the whole view. 296+ * This implementation is based on https://petersteinberger.com/blog/2013/how-to-center-uiscrollview/. 297+ */ 298+-(void)centerContentIfNeeded 299+{ 300+ if (!_scrollView.centerContent) { 301+ return; 302+ } 303+ 304+ CGSize contentSize = self.contentSize; 305+ CGSize boundsSize = self.bounds.size; 306+ if (CGSizeEqualToSize(contentSize, CGSizeZero) || 307+ CGSizeEqualToSize(boundsSize, CGSizeZero)) { 308+ return; 309+ } 310+ 311+ CGFloat top = 0, left = 0; 312+ if (contentSize.width < boundsSize.width) { 313+ left = (boundsSize.width - contentSize.width) * 0.5f; 314+ } 315+ if (contentSize.height < boundsSize.height) { 316+ top = (boundsSize.height - contentSize.height) * 0.5f; 317+ } 318+ _scrollView.contentInset = UIEdgeInsetsMake(top, left, top, left); 319+} 320+ 321 - (void)addScrollListener:(NSObject<UIScrollViewDelegate> *)scrollListener 322 { 323 [_scrollListeners addObject:scrollListener]; 324@@ -933,6 +959,7 @@ - (void)updateContentSizeIfNeeded 325 CGSize contentSize = self.contentSize; 326 if (!CGSizeEqualToSize(_scrollView.contentSize, contentSize)) { 327 _scrollView.contentSize = contentSize; 328+ [self centerContentIfNeeded]; 329 } 330 } 331 332@@ -1055,6 +1082,22 @@ -(type)getter \ 333 RCT_SET_AND_PRESERVE_OFFSET(setShowsVerticalScrollIndicator, showsVerticalScrollIndicator, BOOL) 334 RCT_SET_AND_PRESERVE_OFFSET(setZoomScale, zoomScale, CGFloat); 335 336+- (void)setScrollIndicatorInsets:(UIEdgeInsets)value 337+{ 338+ [_scrollView setScrollIndicatorInsets:value]; 339+} 340+ 341+- (UIEdgeInsets)scrollIndicatorInsets 342+{ 343+ UIEdgeInsets verticalScrollIndicatorInsets = [_scrollView verticalScrollIndicatorInsets]; 344+ UIEdgeInsets horizontalScrollIndicatorInsets = [_scrollView horizontalScrollIndicatorInsets]; 345+ return UIEdgeInsetsMake( 346+ verticalScrollIndicatorInsets.top, 347+ horizontalScrollIndicatorInsets.left, 348+ verticalScrollIndicatorInsets.bottom, 349+ horizontalScrollIndicatorInsets.right); 350+} 351+ 352 - (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjusts API_AVAILABLE(ios(13.0)) 353 { 354 // `automaticallyAdjustsScrollIndicatorInsets` is available since iOS 13. 355diff --git a/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m b/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m 356index cd1e7eb..c1d0172 100644 357--- a/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m 358+++ b/node_modules/react-native/React/Views/ScrollView/RCTScrollViewManager.m 359@@ -83,6 +83,7 @@ - (UIView *)view 360 RCT_EXPORT_VIEW_PROPERTY(scrollEventThrottle, NSTimeInterval) 361 RCT_EXPORT_VIEW_PROPERTY(zoomScale, CGFloat) 362 RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets) 363+RCT_EXPORT_VIEW_PROPERTY(scrollIndicatorInsets, UIEdgeInsets) 364 RCT_EXPORT_VIEW_PROPERTY(verticalScrollIndicatorInsets, UIEdgeInsets) 365 RCT_EXPORT_VIEW_PROPERTY(scrollToOverflowEnabled, BOOL) 366 RCT_EXPORT_VIEW_PROPERTY(snapToInterval, int)