@lodev09/react-native-true-sheet 3.9.7 → 3.9.9
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/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +2 -0
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +3 -0
- package/ios/TrueSheetViewController.mm +25 -0
- package/ios/core/TrueSheetGrabberView.h +3 -0
- package/ios/core/TrueSheetGrabberView.mm +11 -1
- package/package.json +3 -6
|
@@ -624,6 +624,7 @@ class TrueSheetViewController(private val reactContext: ThemedReactContext) :
|
|
|
624
624
|
|
|
625
625
|
isSheetVisible = false
|
|
626
626
|
wasHiddenByScreen = true
|
|
627
|
+
backCallback?.isEnabled = false
|
|
627
628
|
|
|
628
629
|
dimViews.forEach { it.animate().alpha(0f).setDuration(SCREEN_FADE_DURATION).start() }
|
|
629
630
|
sheet.animate()
|
|
@@ -643,6 +644,7 @@ class TrueSheetViewController(private val reactContext: ThemedReactContext) :
|
|
|
643
644
|
setSheetVisibility(true)
|
|
644
645
|
sheetView?.alpha = 1f
|
|
645
646
|
updateDimAmount(animated = true)
|
|
647
|
+
backCallback?.isEnabled = true
|
|
646
648
|
}
|
|
647
649
|
|
|
648
650
|
/**
|
|
@@ -7,6 +7,7 @@ import android.view.MotionEvent
|
|
|
7
7
|
import android.view.ViewConfiguration
|
|
8
8
|
import android.widget.ScrollView
|
|
9
9
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
|
10
|
+
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
|
10
11
|
import com.facebook.react.uimanager.PointerEvents
|
|
11
12
|
import com.facebook.react.uimanager.ReactPointerEventsView
|
|
12
13
|
import com.lodev09.truesheet.utils.isDescendantOf
|
|
@@ -98,7 +99,9 @@ class TrueSheetCoordinatorLayout(context: Context) :
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
val scrollView = delegate?.findScrollView()
|
|
102
|
+
val hasRefreshControl = scrollView?.parent is SwipeRefreshLayout
|
|
101
103
|
val cannotScroll = scrollView != null &&
|
|
104
|
+
!hasRefreshControl &&
|
|
102
105
|
scrollView.scrollY == 0 &&
|
|
103
106
|
!scrollView.canScrollVertically(1)
|
|
104
107
|
|
|
@@ -743,10 +743,35 @@ using namespace facebook::react;
|
|
|
743
743
|
[_grabberView applyConfiguration];
|
|
744
744
|
_grabberView.hidden = !showGrabber;
|
|
745
745
|
|
|
746
|
+
__weak __typeof(self) weakSelf = self;
|
|
747
|
+
_grabberView.onTap = ^{
|
|
748
|
+
[weakSelf handleGrabberTap];
|
|
749
|
+
};
|
|
750
|
+
|
|
746
751
|
[self.view bringSubviewToFront:_grabberView];
|
|
747
752
|
} else {
|
|
748
753
|
self.sheet.prefersGrabberVisible = showGrabber;
|
|
749
754
|
_grabberView.hidden = YES;
|
|
755
|
+
_grabberView.onTap = nil;
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
- (void)handleGrabberTap {
|
|
760
|
+
NSInteger detentCount = _detents.count;
|
|
761
|
+
if (detentCount == 0)
|
|
762
|
+
return;
|
|
763
|
+
|
|
764
|
+
NSInteger currentIndex = self.currentDetentIndex;
|
|
765
|
+
if (currentIndex < 0)
|
|
766
|
+
return;
|
|
767
|
+
|
|
768
|
+
NSInteger nextIndex = (currentIndex + 1) % detentCount;
|
|
769
|
+
if (nextIndex == 0 && detentCount == 1 && self.dismissible) {
|
|
770
|
+
[self.presentingViewController dismissViewControllerAnimated:YES completion:nil];
|
|
771
|
+
} else {
|
|
772
|
+
[self.sheet animateChanges:^{
|
|
773
|
+
[self resizeToDetentIndex:nextIndex];
|
|
774
|
+
}];
|
|
750
775
|
}
|
|
751
776
|
}
|
|
752
777
|
|
|
@@ -34,6 +34,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
34
34
|
/// Whether the grabber color adapts to the background (default: YES)
|
|
35
35
|
@property (nonatomic, strong, nullable) NSNumber *adaptive;
|
|
36
36
|
|
|
37
|
+
/// Called when the grabber is tapped
|
|
38
|
+
@property (nonatomic, copy, nullable) void (^onTap)(void);
|
|
39
|
+
|
|
37
40
|
/// Adds the grabber view to a parent view with proper constraints
|
|
38
41
|
- (void)addToView:(UIView *)parentView;
|
|
39
42
|
|
|
@@ -51,9 +51,11 @@ static const CGFloat kDefaultGrabberTopMargin = 5.0;
|
|
|
51
51
|
#pragma mark - Setup
|
|
52
52
|
|
|
53
53
|
- (void)setupView {
|
|
54
|
-
self.userInteractionEnabled = NO;
|
|
55
54
|
self.clipsToBounds = YES;
|
|
56
55
|
|
|
56
|
+
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap)];
|
|
57
|
+
[self addGestureRecognizer:tap];
|
|
58
|
+
|
|
57
59
|
_vibrancyView = [[UIVisualEffectView alloc] initWithEffect:nil];
|
|
58
60
|
_vibrancyView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
59
61
|
[self addSubview:_vibrancyView];
|
|
@@ -64,6 +66,14 @@ static const CGFloat kDefaultGrabberTopMargin = 5.0;
|
|
|
64
66
|
[_vibrancyView.contentView addSubview:_fillView];
|
|
65
67
|
}
|
|
66
68
|
|
|
69
|
+
#pragma mark - Actions
|
|
70
|
+
|
|
71
|
+
- (void)handleTap {
|
|
72
|
+
if (_onTap) {
|
|
73
|
+
_onTap();
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
67
77
|
#pragma mark - Public
|
|
68
78
|
|
|
69
79
|
- (void)addToView:(UIView *)parentView {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lodev09/react-native-true-sheet",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.9",
|
|
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",
|
|
@@ -185,11 +185,8 @@
|
|
|
185
185
|
"publish": false
|
|
186
186
|
},
|
|
187
187
|
"hooks": {
|
|
188
|
-
"before:init":
|
|
189
|
-
|
|
190
|
-
"yarn test"
|
|
191
|
-
],
|
|
192
|
-
"after:bump": "sed -i '' 's/## Unreleased/## Unreleased\\n\\n## ${version}/' CHANGELOG.md && git add CHANGELOG.md"
|
|
188
|
+
"before:init": "yarn test",
|
|
189
|
+
"after:bump": "yarn tidy && sed -i '' 's/## Unreleased/## Unreleased\\n\\n## ${version}/' CHANGELOG.md"
|
|
193
190
|
},
|
|
194
191
|
"github": {
|
|
195
192
|
"release": true,
|