@swmansion/react-native-bottom-sheet 0.15.0-next.7 → 0.15.0-next.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/README.md +4 -0
- package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetHostView.kt +39 -1
- package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetView.kt +6 -0
- package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetViewManager.kt +5 -0
- package/ios/BottomSheetComponentView.mm +4 -0
- package/ios/BottomSheetContentView.h +1 -0
- package/ios/BottomSheetContentView.mm +10 -0
- package/ios/BottomSheetHostingView.swift +13 -0
- package/lib/module/BottomSheet.js +2 -0
- package/lib/module/BottomSheet.js.map +1 -1
- package/lib/module/BottomSheetNativeComponent.ts +1 -0
- package/lib/typescript/src/BottomSheet.d.ts +7 -0
- package/lib/typescript/src/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetNativeComponent.d.ts +1 -0
- package/lib/typescript/src/BottomSheetNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BottomSheet.tsx +9 -0
- package/src/BottomSheetNativeComponent.ts +1 -0
package/README.md
CHANGED
|
@@ -208,6 +208,10 @@ Decoupling the surface this way keeps the sheet covered as the content height
|
|
|
208
208
|
changes. When content shrinks, the sheet animates to its new height without the
|
|
209
209
|
background briefly exposing blank space behind the content.
|
|
210
210
|
|
|
211
|
+
If your sheet content animates its own height, pass
|
|
212
|
+
`animateContentResize={false}` to update the sheet position immediately when the
|
|
213
|
+
active `'content'` detent changes size.
|
|
214
|
+
|
|
211
215
|
Give the surface a filling style such as `StyleSheet.absoluteFill`. It is
|
|
212
216
|
mounted in a full‍-‍size host, so a surface sized only by its own
|
|
213
217
|
content would collapse and not show.
|
|
@@ -58,6 +58,7 @@ class BottomSheetHostView(context: Context) : ReactViewGroup(context) {
|
|
|
58
58
|
private var detentSpecs: List<DetentSpec> = emptyList()
|
|
59
59
|
private var targetIndex: Int = 0
|
|
60
60
|
var animateIn: Boolean = true
|
|
61
|
+
var animateContentResize: Boolean = true
|
|
61
62
|
var modal: Boolean = false
|
|
62
63
|
set(value) {
|
|
63
64
|
field = value
|
|
@@ -364,10 +365,14 @@ class BottomSheetHostView(context: Context) : ReactViewGroup(context) {
|
|
|
364
365
|
} else {
|
|
365
366
|
val currentVisibleHeight = previousMaxHeight - sheetContainer.translationY
|
|
366
367
|
val targetHeight = detentSpecs.getOrNull(targetIndex)?.height ?: 0f
|
|
368
|
+
val shouldAnimateResize = shouldAnimateContentResize(targetIndex)
|
|
367
369
|
if (kotlin.math.abs(targetHeight - currentVisibleHeight) <= 0.5f) {
|
|
368
370
|
// No meaningful change.
|
|
369
371
|
sheetContainer.translationY = targetTy
|
|
370
372
|
emitPosition()
|
|
373
|
+
} else if (!shouldAnimateResize) {
|
|
374
|
+
sheetContainer.translationY = targetTy
|
|
375
|
+
emitPosition()
|
|
371
376
|
} else {
|
|
372
377
|
// The content detent changed (grew or shrank): re-anchor at the
|
|
373
378
|
// current visible height, then animate to the new target. The
|
|
@@ -393,6 +398,9 @@ class BottomSheetHostView(context: Context) : ReactViewGroup(context) {
|
|
|
393
398
|
updateScrim()
|
|
394
399
|
}
|
|
395
400
|
|
|
401
|
+
private fun shouldAnimateContentResize(index: Int): Boolean =
|
|
402
|
+
animateContentResize || rawDetentSpecs.getOrNull(index)?.kind != DetentKind.CONTENT
|
|
403
|
+
|
|
396
404
|
private fun currentContentHeight(): Float {
|
|
397
405
|
val marker = contentHeightMarker ?: return Float.NaN
|
|
398
406
|
return marker.top.toFloat()
|
|
@@ -825,12 +833,42 @@ class BottomSheetHostView(context: Context) : ReactViewGroup(context) {
|
|
|
825
833
|
}
|
|
826
834
|
}
|
|
827
835
|
|
|
828
|
-
if (
|
|
836
|
+
if (isVerticallyScrollable(view)) {
|
|
829
837
|
return view
|
|
830
838
|
}
|
|
831
839
|
return null
|
|
832
840
|
}
|
|
833
841
|
|
|
842
|
+
private fun isVerticallyScrollable(view: View): Boolean {
|
|
843
|
+
if (!view.canScrollVertically(1) && !view.canScrollVertically(-1)) {
|
|
844
|
+
return false
|
|
845
|
+
}
|
|
846
|
+
return getReactScrollEnabled(view) != false
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
private fun getReactScrollEnabled(view: View): Boolean? {
|
|
850
|
+
val method =
|
|
851
|
+
try {
|
|
852
|
+
view.javaClass.getMethod("getScrollEnabled")
|
|
853
|
+
} catch (_: NoSuchMethodException) {
|
|
854
|
+
return null
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
if (
|
|
858
|
+
method.returnType != Boolean::class.javaPrimitiveType &&
|
|
859
|
+
method.returnType != Boolean::class.javaObjectType
|
|
860
|
+
) {
|
|
861
|
+
return null
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
return try {
|
|
865
|
+
method.isAccessible = true
|
|
866
|
+
method.invoke(view) as? Boolean
|
|
867
|
+
} catch (_: Exception) {
|
|
868
|
+
null
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
|
|
834
872
|
private fun isViewInverted(view: View): Boolean {
|
|
835
873
|
val values = FloatArray(9)
|
|
836
874
|
var current: View? = view
|
|
@@ -112,6 +112,12 @@ class BottomSheetView(context: Context) : ReactViewGroup(context), LifecycleEven
|
|
|
112
112
|
host.animateIn = value
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
var animateContentResize: Boolean
|
|
116
|
+
get() = host.animateContentResize
|
|
117
|
+
set(value) {
|
|
118
|
+
host.animateContentResize = value
|
|
119
|
+
}
|
|
120
|
+
|
|
115
121
|
var modal: Boolean
|
|
116
122
|
get() = host.modal
|
|
117
123
|
set(value) {
|
package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetViewManager.kt
CHANGED
|
@@ -128,6 +128,11 @@ class BottomSheetViewManager :
|
|
|
128
128
|
view.animateIn = animateIn
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
@ReactProp(name = "animateContentResize")
|
|
132
|
+
override fun setAnimateContentResize(view: BottomSheetView, animateContentResize: Boolean) {
|
|
133
|
+
view.animateContentResize = animateContentResize
|
|
134
|
+
}
|
|
135
|
+
|
|
131
136
|
@ReactProp(name = "modal")
|
|
132
137
|
override fun setModal(view: BottomSheetView, modal: Boolean) {
|
|
133
138
|
view.modal = modal
|
|
@@ -113,6 +113,10 @@ using namespace facebook::react;
|
|
|
113
113
|
_sheetView.animateIn = newViewProps.animateIn;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
if (newViewProps.animateContentResize != oldViewProps.animateContentResize) {
|
|
117
|
+
_sheetView.animateContentResize = newViewProps.animateContentResize;
|
|
118
|
+
}
|
|
119
|
+
|
|
116
120
|
if (newViewProps.modal != oldViewProps.modal) {
|
|
117
121
|
_sheetView.modal = newViewProps.modal;
|
|
118
122
|
}
|
|
@@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
17
17
|
|
|
18
18
|
@property (nonatomic, weak, nullable) id<BottomSheetContentViewDelegate> delegate;
|
|
19
19
|
@property (nonatomic) BOOL animateIn;
|
|
20
|
+
@property (nonatomic) BOOL animateContentResize;
|
|
20
21
|
@property (nonatomic) BOOL modal;
|
|
21
22
|
@property (nonatomic) BOOL disableScrollableNegotiation;
|
|
22
23
|
@property (nonatomic, readonly) UIView *sheetContainer;
|
|
@@ -35,6 +35,16 @@
|
|
|
35
35
|
_impl.animateIn = animateIn;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
- (BOOL)animateContentResize
|
|
39
|
+
{
|
|
40
|
+
return _impl.animateContentResize;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
- (void)setAnimateContentResize:(BOOL)animateContentResize
|
|
44
|
+
{
|
|
45
|
+
_impl.animateContentResize = animateContentResize;
|
|
46
|
+
}
|
|
47
|
+
|
|
38
48
|
- (UIView *)sheetContainer
|
|
39
49
|
{
|
|
40
50
|
return _impl.sheetContainer;
|
|
@@ -64,6 +64,7 @@ public final class BottomSheetHostingView: UIView {
|
|
|
64
64
|
|
|
65
65
|
private var targetIndex: Int = 0
|
|
66
66
|
public var animateIn: Bool = true
|
|
67
|
+
public var animateContentResize: Bool = true
|
|
67
68
|
|
|
68
69
|
public let sheetContainer = UIView()
|
|
69
70
|
private let scrimView = UIControl()
|
|
@@ -620,6 +621,7 @@ public final class BottomSheetHostingView: UIView {
|
|
|
620
621
|
}
|
|
621
622
|
|
|
622
623
|
private func isVerticallyScrollable(_ scrollView: UIScrollView) -> Bool {
|
|
624
|
+
guard scrollView.isScrollEnabled else { return false }
|
|
623
625
|
let verticalInset = scrollView.adjustedContentInset.top + scrollView.adjustedContentInset.bottom
|
|
624
626
|
let visibleHeight = max(0, scrollView.bounds.height - verticalInset)
|
|
625
627
|
return scrollView.alwaysBounceVertical || scrollView.contentSize.height > visibleHeight
|
|
@@ -789,10 +791,14 @@ public final class BottomSheetHostingView: UIView {
|
|
|
789
791
|
} else {
|
|
790
792
|
let currentVisibleHeight = previousMaxHeight - currentTranslationY
|
|
791
793
|
let targetHeight = detent(at: targetIndex).height
|
|
794
|
+
let shouldAnimateResize = shouldAnimateContentResize(at: targetIndex)
|
|
792
795
|
if abs(targetHeight - currentVisibleHeight) <= 0.5 {
|
|
793
796
|
// No meaningful change.
|
|
794
797
|
sheetContainer.transform = CGAffineTransform(translationX: 0, y: targetTy)
|
|
795
798
|
emitPosition()
|
|
799
|
+
} else if !shouldAnimateResize {
|
|
800
|
+
sheetContainer.transform = CGAffineTransform(translationX: 0, y: targetTy)
|
|
801
|
+
emitPosition()
|
|
796
802
|
} else {
|
|
797
803
|
// The content detent changed (grew or shrank): re-anchor at the
|
|
798
804
|
// current visible height, then animate to the new target. The surface
|
|
@@ -813,6 +819,13 @@ public final class BottomSheetHostingView: UIView {
|
|
|
813
819
|
}
|
|
814
820
|
}
|
|
815
821
|
|
|
822
|
+
private func shouldAnimateContentResize(at index: Int) -> Bool {
|
|
823
|
+
guard rawDetentSpecs.indices.contains(index) else {
|
|
824
|
+
return animateContentResize
|
|
825
|
+
}
|
|
826
|
+
return animateContentResize || rawDetentSpecs[index].kind != .content
|
|
827
|
+
}
|
|
828
|
+
|
|
816
829
|
private func refreshContentHeightMarker() {
|
|
817
830
|
let marker = findContentHeightMarker()
|
|
818
831
|
guard marker !== contentHeightMarker else { return }
|
|
@@ -27,6 +27,7 @@ export const BottomSheet = props => {
|
|
|
27
27
|
detents = [0, 'content'],
|
|
28
28
|
index,
|
|
29
29
|
animateIn = true,
|
|
30
|
+
animateContentResize = true,
|
|
30
31
|
onIndexChange,
|
|
31
32
|
onSettle,
|
|
32
33
|
onPositionChange,
|
|
@@ -103,6 +104,7 @@ export const BottomSheet = props => {
|
|
|
103
104
|
maxDetentHeight: maxHeight,
|
|
104
105
|
index: index,
|
|
105
106
|
animateIn: animateIn,
|
|
107
|
+
animateContentResize: animateContentResize,
|
|
106
108
|
modal: modal,
|
|
107
109
|
nativeOverlay: usesNativeOverlay,
|
|
108
110
|
disableScrollableNegotiation: disableScrollableNegotiation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useState","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","BottomSheetNativeView","BottomSheetSurfaceNativeComponent","Portal","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","props","children","surface","style","detents","index","animateIn","onIndexChange","onSettle","onPositionChange","wrapNativeView","modal","nativeOverlay","disableScrollableNegotiation","scrimColor","scrimOpacities","height","windowHeight","insets","maxHeight","top","nativeDetents","map","detent","isDetentProgrammatic","value","resolveDetentValue","kind","Math","max","min","clampedIndex","length","selectedDetentValue","isCollapsed","resolvedScrimOpacity","usesNativeOverlay","handleIndexChange","event","nativeEvent","handleSettle","NativeView","sheet","absoluteFill","pointerEvents","position","left","right","bottom","maxDetentHeight","collapsable","flex"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAA4C,OAAO;AAEpE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SACEC,gBAAgB,EAChBC,iBAAiB,QACZ,gCAAgC;AAEvC,OAAOC,qBAAqB,MAErB,8BAA8B;AACrC,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,SAASC,MAAM,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,SAASC,YAAY,QAAQ,uBAAoB;;AAEjD;AACA;AACA;AACA;;AAaA;AACA;AACA;;
|
|
1
|
+
{"version":3,"names":["useState","StyleSheet","View","useSafeAreaFrame","useSafeAreaInsets","BottomSheetNativeView","BottomSheetSurfaceNativeComponent","Portal","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","props","children","surface","style","detents","index","animateIn","animateContentResize","onIndexChange","onSettle","onPositionChange","wrapNativeView","modal","nativeOverlay","disableScrollableNegotiation","scrimColor","scrimOpacities","height","windowHeight","insets","maxHeight","top","nativeDetents","map","detent","isDetentProgrammatic","value","resolveDetentValue","kind","Math","max","min","clampedIndex","length","selectedDetentValue","isCollapsed","resolvedScrimOpacity","usesNativeOverlay","handleIndexChange","event","nativeEvent","handleSettle","NativeView","sheet","absoluteFill","pointerEvents","position","left","right","bottom","maxDetentHeight","collapsable","flex"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAA4C,OAAO;AAEpE,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAC/C,SACEC,gBAAgB,EAChBC,iBAAiB,QACZ,gCAAgC;AAEvC,OAAOC,qBAAqB,MAErB,8BAA8B;AACrC,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,SAASC,MAAM,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAG/C,SAASC,YAAY,QAAQ,uBAAoB;;AAEjD;AACA;AACA;AACA;;AAaA;AACA;AACA;;AAqGA;AACA,O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KAAK,IAAI;EACrC;EACA,OAAO,KAAK;AACd;AAEA,SAAS6B,kBAAkBA,CAACH,MAAc,EAAE;EAC1C,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACjD,OAAOA,MAAM,CAACE,KAAK;EACrB;EACA,OAAOF,MAAM;AACf","ignoreList":[]}
|
|
@@ -16,6 +16,7 @@ export interface NativeProps extends ViewProps {
|
|
|
16
16
|
maxDetentHeight: CodegenTypes.Double;
|
|
17
17
|
index: CodegenTypes.Int32;
|
|
18
18
|
animateIn?: CodegenTypes.WithDefault<boolean, true>;
|
|
19
|
+
animateContentResize?: CodegenTypes.WithDefault<boolean, true>;
|
|
19
20
|
modal: boolean;
|
|
20
21
|
nativeOverlay?: boolean;
|
|
21
22
|
disableScrollableNegotiation?: boolean;
|
|
@@ -45,6 +45,13 @@ export interface BottomSheetProps {
|
|
|
45
45
|
index: number;
|
|
46
46
|
/** Whether the sheet should animate in on first layout. */
|
|
47
47
|
animateIn?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Whether the sheet should animate when the active `'content'` detent changes
|
|
50
|
+
* height. Disable this when your content animates its own height.
|
|
51
|
+
*
|
|
52
|
+
* @default true
|
|
53
|
+
*/
|
|
54
|
+
animateContentResize?: boolean;
|
|
48
55
|
/**
|
|
49
56
|
* Called when a user-driven snap is initiated: the moment a drag commits to a
|
|
50
57
|
* detent, before the animation settles. Does not fire for programmatic `index`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACrE,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAO/E,OAA8B,EAC5B,KAAK,WAAW,EACjB,MAAM,8BAA8B,CAAC;AAG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;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,CACjB,KAAK,EAAE,oBAAoB,CAAC,uBAAuB,CAAC,KACjD,IAAI,CAAC;IACV;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,EAAE,CACf,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,KAClC,aAAa,CAAC,WAAW,CAAC,CAAC;IAChC;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;CACxC;AAED,KAAK,yBAAyB,GAAG;IAC/B,gDAAgD;IAChD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GACrD,yBAAyB,CAAC;AAE5B,gFAAgF;AAChF,eAAO,MAAM,WAAW,GAAI,OAAO,gBAAgB,4CA2IlD,CAAC"}
|
|
@@ -9,6 +9,7 @@ export interface NativeProps extends ViewProps {
|
|
|
9
9
|
maxDetentHeight: CodegenTypes.Double;
|
|
10
10
|
index: CodegenTypes.Int32;
|
|
11
11
|
animateIn?: CodegenTypes.WithDefault<boolean, true>;
|
|
12
|
+
animateContentResize?: CodegenTypes.WithDefault<boolean, true>;
|
|
12
13
|
modal: boolean;
|
|
13
14
|
nativeOverlay?: boolean;
|
|
14
15
|
disableScrollableNegotiation?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/BottomSheetNativeComponent.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,KAAK,YAAY,GAAG,QAAQ,CAAC;IAC3B,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,OAAO,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IACrC,eAAe,EAAE,YAAY,CAAC,MAAM,CAAC;IACrC,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAC1B,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACpD,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,cAAc,CAAC,EAAE,aAAa,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;IACpD,aAAa,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAC7C,QAAQ,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;KAAE,CAAC,CACxC,CAAC;IACF,QAAQ,CAAC,EAAE,YAAY,CAAC,kBAAkB,CACxC,QAAQ,CAAC;QAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAA;KAAE,CAAC,CACxC,CAAC;IACF,gBAAgB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAChD,QAAQ,CAAC;QAAE,QAAQ,EAAE,YAAY,CAAC,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AC,CACxC,CAAC;IACF,gBAAgB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAChD,QAAQ,CAAC;QAAE,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAC;QAAC,KAAK,EAAE,YAAY,CAAC,MAAM,CAAA;KAAE,CAAC,CACxE,CAAC;CACH;;AAED,wBAAsE"}
|
package/package.json
CHANGED
package/src/BottomSheet.tsx
CHANGED
|
@@ -57,6 +57,13 @@ export interface BottomSheetProps {
|
|
|
57
57
|
index: number;
|
|
58
58
|
/** Whether the sheet should animate in on first layout. */
|
|
59
59
|
animateIn?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Whether the sheet should animate when the active `'content'` detent changes
|
|
62
|
+
* height. Disable this when your content animates its own height.
|
|
63
|
+
*
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
animateContentResize?: boolean;
|
|
60
67
|
/**
|
|
61
68
|
* Called when a user-driven snap is initiated: the moment a drag commits to a
|
|
62
69
|
* detent, before the animation settles. Does not fire for programmatic `index`
|
|
@@ -136,6 +143,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
|
|
|
136
143
|
detents = [0, 'content'],
|
|
137
144
|
index,
|
|
138
145
|
animateIn = true,
|
|
146
|
+
animateContentResize = true,
|
|
139
147
|
onIndexChange,
|
|
140
148
|
onSettle,
|
|
141
149
|
onPositionChange,
|
|
@@ -227,6 +235,7 @@ export const BottomSheet = (props: BottomSheetProps) => {
|
|
|
227
235
|
maxDetentHeight={maxHeight}
|
|
228
236
|
index={index}
|
|
229
237
|
animateIn={animateIn}
|
|
238
|
+
animateContentResize={animateContentResize}
|
|
230
239
|
modal={modal}
|
|
231
240
|
nativeOverlay={usesNativeOverlay}
|
|
232
241
|
disableScrollableNegotiation={disableScrollableNegotiation}
|
|
@@ -16,6 +16,7 @@ export interface NativeProps extends ViewProps {
|
|
|
16
16
|
maxDetentHeight: CodegenTypes.Double;
|
|
17
17
|
index: CodegenTypes.Int32;
|
|
18
18
|
animateIn?: CodegenTypes.WithDefault<boolean, true>;
|
|
19
|
+
animateContentResize?: CodegenTypes.WithDefault<boolean, true>;
|
|
19
20
|
modal: boolean;
|
|
20
21
|
nativeOverlay?: boolean;
|
|
21
22
|
disableScrollableNegotiation?: boolean;
|