@lodev09/react-native-true-sheet 3.0.0-beta.11 → 3.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -126,46 +126,53 @@ using namespace facebook::react;
126
126
  }
127
127
  }
128
128
 
129
+ - (RCTScrollViewComponentView *)findScrollViewInSubviews:(NSArray<UIView *> *)subviews {
130
+ for (UIView *subview in subviews) {
131
+ if ([subview isKindOfClass:RCTScrollViewComponentView.class]) {
132
+ return (RCTScrollViewComponentView *)subview;
133
+ }
134
+ }
135
+ return nil;
136
+ }
137
+
129
138
  - (RCTScrollViewComponentView *)findScrollView:(UIView **)outTopSibling {
130
139
  if (self.subviews.count == 0) {
131
140
  return nil;
132
141
  }
133
142
 
134
- RCTScrollViewComponentView *scrollView = nil;
135
143
  UIView *topSibling = nil;
136
144
 
137
145
  // Check first-level children for scroll views (ScrollView or FlatList)
138
- for (UIView *subview in self.subviews) {
139
- if ([subview isKindOfClass:RCTScrollViewComponentView.class]) {
140
- scrollView = (RCTScrollViewComponentView *)subview;
141
-
142
- // Find the view positioned directly above this ScrollView by frame position
143
- if (self.subviews.count > 1) {
144
- CGFloat scrollViewTop = CGRectGetMinY(scrollView.frame);
145
- CGFloat closestDistance = CGFLOAT_MAX;
146
-
147
- for (UIView *sibling in self.subviews) {
148
- // Skip the ScrollView itself
149
- if (sibling == scrollView) {
150
- continue;
151
- }
152
-
153
- CGFloat siblingBottom = CGRectGetMaxY(sibling.frame);
154
-
155
- // Check if this sibling is positioned above the ScrollView
156
- if (siblingBottom <= scrollViewTop) {
157
- CGFloat distance = scrollViewTop - siblingBottom;
158
-
159
- // Find the closest view above (smallest distance)
160
- if (distance < closestDistance) {
161
- closestDistance = distance;
162
- topSibling = sibling;
163
- }
164
- }
165
- }
146
+ RCTScrollViewComponentView *scrollView = [self findScrollViewInSubviews:self.subviews];
147
+
148
+ // If not found, check second level (grandchildren)
149
+ if (!scrollView) {
150
+ for (UIView *subview in self.subviews) {
151
+ scrollView = [self findScrollViewInSubviews:subview.subviews];
152
+ if (scrollView) {
153
+ break;
166
154
  }
155
+ }
156
+ }
167
157
 
168
- break; // Found ScrollView, no need to continue
158
+ // Find the view positioned directly above the ScrollView (only for first-level)
159
+ if (scrollView && scrollView.superview == self && self.subviews.count > 1) {
160
+ CGFloat scrollViewTop = CGRectGetMinY(scrollView.frame);
161
+ CGFloat closestDistance = CGFLOAT_MAX;
162
+
163
+ for (UIView *sibling in self.subviews) {
164
+ if (sibling == scrollView) {
165
+ continue;
166
+ }
167
+
168
+ CGFloat siblingBottom = CGRectGetMaxY(sibling.frame);
169
+ if (siblingBottom <= scrollViewTop) {
170
+ CGFloat distance = scrollViewTop - siblingBottom;
171
+ if (distance < closestDistance) {
172
+ closestDistance = distance;
173
+ topSibling = sibling;
174
+ }
175
+ }
169
176
  }
170
177
  }
171
178
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lodev09/react-native-true-sheet",
3
- "version": "3.0.0-beta.11",
3
+ "version": "3.0.0-beta.12",
4
4
  "description": "The true native bottom sheet experience for your React Native Apps.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./lib/module/index.js",