@lodev09/react-native-true-sheet 3.9.0-beta.5 → 3.9.0-beta.7
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/README.md +2 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetView.kt +4 -1
- package/android/src/main/java/com/lodev09/truesheet/TrueSheetViewController.kt +0 -1
- package/android/src/main/java/com/lodev09/truesheet/core/TrueSheetCoordinatorLayout.kt +2 -6
- package/ios/TrueSheetView.mm +6 -3
- package/ios/TrueSheetViewController.mm +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/lodev09/react-native-true-sheet/actions/workflows/checks.yml)
|
|
4
4
|
[](https://www.npmjs.com/package/@lodev09/react-native-true-sheet)
|
|
5
|
+
[](https://deepwiki.com/lodev09/react-native-true-sheet)
|
|
5
6
|
|
|
6
7
|
The true native bottom sheet experience for your React Native Apps. 💩
|
|
7
8
|
|
|
@@ -37,7 +38,7 @@ The true native bottom sheet experience for your React Native Apps. 💩
|
|
|
37
38
|
| TrueSheet | React Native | Expo SDK |
|
|
38
39
|
|-----------|--------------|----------|
|
|
39
40
|
| 3.7+ | 0.81+ | 54+ |
|
|
40
|
-
| 3.6 | 0.
|
|
41
|
+
| 3.6 | 0.80 | 52-53 |
|
|
41
42
|
|
|
42
43
|
### Expo
|
|
43
44
|
|
|
@@ -551,7 +551,10 @@ class TrueSheetView(private val reactContext: ThemedReactContext) :
|
|
|
551
551
|
}
|
|
552
552
|
|
|
553
553
|
override fun viewControllerDidChangeSize(width: Int, height: Int) {
|
|
554
|
-
|
|
554
|
+
// On android scrollable, we need the actual sheet height to get proper ScrollView height.
|
|
555
|
+
// Unlike IOS where ScrollView is pinned to the container.
|
|
556
|
+
val effectiveHeight = if (viewController.scrollable) height else viewController.screenHeight
|
|
557
|
+
updateState(width, effectiveHeight)
|
|
555
558
|
}
|
|
556
559
|
|
|
557
560
|
override fun viewControllerWillFocus() {
|
|
@@ -454,7 +454,6 @@ class TrueSheetViewController(private val reactContext: ThemedReactContext) :
|
|
|
454
454
|
sheetView?.let { emitChangePositionDelegate(it.top, realtime = false) }
|
|
455
455
|
}
|
|
456
456
|
|
|
457
|
-
override val isScrollable: Boolean get() = scrollable
|
|
458
457
|
override fun findScrollView(): ScrollView? = containerView?.contentView?.findScrollView()
|
|
459
458
|
override fun findSheetView(): TrueSheetBottomSheetView? = sheetView
|
|
460
459
|
|
|
@@ -12,7 +12,6 @@ import com.facebook.react.uimanager.ReactPointerEventsView
|
|
|
12
12
|
import com.lodev09.truesheet.utils.isDescendantOf
|
|
13
13
|
|
|
14
14
|
interface TrueSheetCoordinatorLayoutDelegate {
|
|
15
|
-
val isScrollable: Boolean
|
|
16
15
|
fun coordinatorLayoutDidLayout(changed: Boolean)
|
|
17
16
|
fun coordinatorLayoutDidChangeConfiguration()
|
|
18
17
|
fun findScrollView(): ScrollView?
|
|
@@ -96,11 +95,8 @@ class TrueSheetCoordinatorLayout(context: Context) :
|
|
|
96
95
|
* See: https://github.com/facebook/react-native/pull/44099
|
|
97
96
|
*/
|
|
98
97
|
override fun onInterceptTouchEvent(ev: MotionEvent): Boolean {
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
clearStaleNestedScrollingChildRef()
|
|
102
|
-
}
|
|
103
|
-
return super.onInterceptTouchEvent(ev)
|
|
98
|
+
if (ev.actionMasked == MotionEvent.ACTION_DOWN) {
|
|
99
|
+
clearStaleNestedScrollingChildRef()
|
|
104
100
|
}
|
|
105
101
|
|
|
106
102
|
val scrollView = delegate?.findScrollView()
|
package/ios/TrueSheetView.mm
CHANGED
|
@@ -268,9 +268,9 @@ using namespace facebook::react;
|
|
|
268
268
|
- (void)updateState:(const State::Shared &)state oldState:(const State::Shared &)oldState {
|
|
269
269
|
_state = std::static_pointer_cast<TrueSheetViewShadowNode::ConcreteState const>(state);
|
|
270
270
|
|
|
271
|
-
// Initialize with _controller size to set initial width
|
|
272
271
|
if (_controller) {
|
|
273
|
-
|
|
272
|
+
// Initialize with _controller size to set initial width
|
|
273
|
+
[self viewControllerDidChangeSize:_controller.view.frame.size];
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
|
|
@@ -640,7 +640,10 @@ using namespace facebook::react;
|
|
|
640
640
|
}
|
|
641
641
|
|
|
642
642
|
- (void)viewControllerDidChangeSize:(CGSize)size {
|
|
643
|
-
|
|
643
|
+
// TODO: Explicit screen height for now until synchronous layout is supported.
|
|
644
|
+
CGSize effectiveSize = CGSizeMake(size.width, _controller.screenHeight);
|
|
645
|
+
|
|
646
|
+
[self updateStateWithSize:effectiveSize];
|
|
644
647
|
}
|
|
645
648
|
|
|
646
649
|
- (void)viewControllerWillFocus {
|
|
@@ -219,7 +219,6 @@ using namespace facebook::react;
|
|
|
219
219
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
220
220
|
NSInteger index = [self currentDetentIndex];
|
|
221
221
|
CGFloat detent = [self detentValueForIndex:index];
|
|
222
|
-
[self.delegate viewControllerDidChangeSize:self.view.frame.size];
|
|
223
222
|
[self.delegate viewControllerDidPresentAtIndex:index position:self.currentPosition detent:detent];
|
|
224
223
|
[self.delegate viewControllerDidFocus];
|
|
225
224
|
|
|
@@ -314,7 +313,6 @@ using namespace facebook::react;
|
|
|
314
313
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
315
314
|
[self storeResolvedPositionForIndex:pendingIndex];
|
|
316
315
|
CGFloat detent = [self detentValueForIndex:pendingIndex];
|
|
317
|
-
[self.delegate viewControllerDidChangeSize:self.view.frame.size];
|
|
318
316
|
[self.delegate viewControllerDidChangeDetent:pendingIndex position:self.currentPosition detent:detent];
|
|
319
317
|
[self emitChangePositionDelegateWithPosition:self.currentPosition realtime:NO debug:@"pending detent change"];
|
|
320
318
|
});
|
|
@@ -809,7 +807,6 @@ using namespace facebook::react;
|
|
|
809
807
|
NSInteger index = self.currentDetentIndex;
|
|
810
808
|
if (index >= 0) {
|
|
811
809
|
CGFloat detent = [self detentValueForIndex:index];
|
|
812
|
-
[self.delegate viewControllerDidChangeSize:self.view.frame.size];
|
|
813
810
|
[self.delegate viewControllerDidChangeDetent:index position:self.currentPosition detent:detent];
|
|
814
811
|
}
|
|
815
812
|
});
|
package/package.json
CHANGED