@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.
- package/ios/TrueSheetContentView.mm +37 -30
- package/package.json +1 -1
|
@@ -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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
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
|
-
|
|
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