@lodev09/react-native-true-sheet 3.5.2 → 3.5.4
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 +5 -1
- package/ios/TrueSheetView.mm +15 -1
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
#import <react/renderer/components/TrueSheetSpec/EventEmitters.h>
|
|
15
15
|
#import <react/renderer/components/TrueSheetSpec/Props.h>
|
|
16
16
|
#import <react/renderer/components/TrueSheetSpec/RCTComponentViewHelpers.h>
|
|
17
|
+
#import "TrueSheetView.h"
|
|
17
18
|
#import "TrueSheetViewController.h"
|
|
18
19
|
#import "utils/LayoutUtil.h"
|
|
19
20
|
|
|
@@ -128,6 +129,9 @@ using namespace facebook::react;
|
|
|
128
129
|
|
|
129
130
|
- (RCTScrollViewComponentView *)findScrollViewInSubviews:(NSArray<UIView *> *)subviews {
|
|
130
131
|
for (UIView *subview in subviews) {
|
|
132
|
+
if ([subview isKindOfClass:TrueSheetView.class]) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
131
135
|
if ([subview isKindOfClass:RCTScrollViewComponentView.class]) {
|
|
132
136
|
return (RCTScrollViewComponentView *)subview;
|
|
133
137
|
}
|
|
@@ -161,7 +165,7 @@ using namespace facebook::react;
|
|
|
161
165
|
CGFloat closestDistance = CGFLOAT_MAX;
|
|
162
166
|
|
|
163
167
|
for (UIView *sibling in self.subviews) {
|
|
164
|
-
if (sibling == scrollView) {
|
|
168
|
+
if (sibling == scrollView || [sibling isKindOfClass:TrueSheetView.class]) {
|
|
165
169
|
continue;
|
|
166
170
|
}
|
|
167
171
|
|
package/ios/TrueSheetView.mm
CHANGED
|
@@ -51,6 +51,7 @@ using namespace facebook::react;
|
|
|
51
51
|
BOOL _initialDetentAnimated;
|
|
52
52
|
BOOL _isSheetUpdatePending;
|
|
53
53
|
BOOL _pendingLayoutUpdate;
|
|
54
|
+
BOOL _pendingInitialPresentation;
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
#pragma mark - Initialization
|
|
@@ -73,6 +74,7 @@ using namespace facebook::react;
|
|
|
73
74
|
_initialDetentAnimated = YES;
|
|
74
75
|
_scrollable = NO;
|
|
75
76
|
_isSheetUpdatePending = NO;
|
|
77
|
+
_pendingInitialPresentation = NO;
|
|
76
78
|
}
|
|
77
79
|
return self;
|
|
78
80
|
}
|
|
@@ -87,6 +89,9 @@ using namespace facebook::react;
|
|
|
87
89
|
if (self.tag > 0) {
|
|
88
90
|
[TrueSheetModule registerView:self withTag:@(self.tag)];
|
|
89
91
|
}
|
|
92
|
+
|
|
93
|
+
// Handle pending initial presentation after view is in window hierarchy
|
|
94
|
+
[self presentInitialDetentIfNeeded];
|
|
90
95
|
}
|
|
91
96
|
|
|
92
97
|
- (void)dealloc {
|
|
@@ -247,7 +252,8 @@ using namespace facebook::react;
|
|
|
247
252
|
[_controller setupDraggable];
|
|
248
253
|
} else if (_initialDetentIndex >= 0) {
|
|
249
254
|
_pendingLayoutUpdate = NO;
|
|
250
|
-
|
|
255
|
+
_pendingInitialPresentation = YES;
|
|
256
|
+
[self presentInitialDetentIfNeeded];
|
|
251
257
|
}
|
|
252
258
|
}
|
|
253
259
|
|
|
@@ -495,6 +501,14 @@ using namespace facebook::react;
|
|
|
495
501
|
|
|
496
502
|
#pragma mark - Private Helpers
|
|
497
503
|
|
|
504
|
+
- (void)presentInitialDetentIfNeeded {
|
|
505
|
+
if (!_pendingInitialPresentation || _initialDetentIndex < 0 || _controller.isPresented || !self.window)
|
|
506
|
+
return;
|
|
507
|
+
|
|
508
|
+
_pendingInitialPresentation = NO;
|
|
509
|
+
[self presentAtIndex:_initialDetentIndex animated:_initialDetentAnimated completion:nil];
|
|
510
|
+
}
|
|
511
|
+
|
|
498
512
|
- (UIViewController *)findPresentingViewController {
|
|
499
513
|
UIWindow *keyWindow = [WindowUtil keyWindow];
|
|
500
514
|
if (!keyWindow)
|
package/package.json
CHANGED