@swmansion/react-native-bottom-sheet 0.8.0-next.5 → 0.8.0-next.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/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetView.kt +23 -7
- package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetViewManager.kt +11 -0
- package/ios/BottomSheetComponentView.mm +13 -1
- package/ios/BottomSheetContentView.h +1 -0
- package/ios/BottomSheetContentView.mm +5 -0
- package/ios/RNSBottomSheetHostingView.swift +35 -2
- package/lib/module/BottomSheet.js +5 -0
- package/lib/module/BottomSheet.js.map +1 -1
- package/lib/module/BottomSheetNativeComponent.ts +3 -0
- package/lib/typescript/src/BottomSheet.d.ts +2 -1
- package/lib/typescript/src/BottomSheet.d.ts.map +1 -1
- package/lib/typescript/src/BottomSheetNativeComponent.d.ts +3 -0
- package/lib/typescript/src/BottomSheetNativeComponent.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/BottomSheet.tsx +6 -0
- package/src/BottomSheetNativeComponent.ts +3 -0
|
@@ -25,6 +25,7 @@ private data class DetentSpec(val height: Float, val programmatic: Boolean)
|
|
|
25
25
|
|
|
26
26
|
interface BottomSheetViewListener {
|
|
27
27
|
fun onIndexChange(index: Int)
|
|
28
|
+
fun onSettle(index: Int)
|
|
28
29
|
fun onPositionChange(position: Double)
|
|
29
30
|
}
|
|
30
31
|
|
|
@@ -140,7 +141,7 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
140
141
|
val closedTy = detentSpecs.lastOrNull()?.height ?: h.toFloat()
|
|
141
142
|
sheetContainer.translationY = closedTy
|
|
142
143
|
emitPosition()
|
|
143
|
-
snapToIndex(targetIndex, 0f, emitIndexChange = false)
|
|
144
|
+
snapToIndex(targetIndex, 0f, emitIndexChange = false, emitSettle = false)
|
|
144
145
|
} else {
|
|
145
146
|
sheetContainer.translationY = translationY(targetIndex)
|
|
146
147
|
emitPosition()
|
|
@@ -180,14 +181,24 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
180
181
|
val programmatic = dict["programmatic"] as? Boolean ?: false
|
|
181
182
|
DetentSpec(height = (height * density).toFloat(), programmatic = programmatic)
|
|
182
183
|
}
|
|
183
|
-
|
|
184
184
|
if (width > 0 && height > 0 && detentSpecs.isNotEmpty()) {
|
|
185
185
|
layoutSheetContainer(width, height)
|
|
186
186
|
|
|
187
|
-
if (hasLaidOut &&
|
|
187
|
+
if (hasLaidOut && !isPanning) {
|
|
188
188
|
targetIndex = targetIndex.coerceIn(0, detentSpecs.size - 1)
|
|
189
|
-
|
|
190
|
-
|
|
189
|
+
if (activeAnimation != null) {
|
|
190
|
+
val currentTy = sheetContainer.translationY
|
|
191
|
+
activeAnimation?.cancel()
|
|
192
|
+
activeAnimation = null
|
|
193
|
+
stopChoreographer()
|
|
194
|
+
sheetContainer.translationY =
|
|
195
|
+
currentTy.coerceIn(0f, detentSpecs.lastOrNull()?.height ?: currentTy)
|
|
196
|
+
emitPosition()
|
|
197
|
+
snapToIndex(targetIndex, 0f, emitIndexChange = false, emitSettle = false)
|
|
198
|
+
} else {
|
|
199
|
+
sheetContainer.translationY = translationY(targetIndex)
|
|
200
|
+
emitPosition()
|
|
201
|
+
}
|
|
191
202
|
}
|
|
192
203
|
}
|
|
193
204
|
|
|
@@ -287,12 +298,16 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
287
298
|
|
|
288
299
|
// MARK: - Spring animation
|
|
289
300
|
|
|
290
|
-
private fun snapToIndex(
|
|
301
|
+
private fun snapToIndex(
|
|
302
|
+
index: Int,
|
|
303
|
+
velocity: Float,
|
|
304
|
+
emitIndexChange: Boolean = true,
|
|
305
|
+
emitSettle: Boolean = true,
|
|
306
|
+
) {
|
|
291
307
|
if (index < 0 || index >= detentSpecs.size) return
|
|
292
308
|
targetIndex = index
|
|
293
309
|
|
|
294
310
|
val targetTy = translationY(index)
|
|
295
|
-
|
|
296
311
|
activeAnimation?.cancel()
|
|
297
312
|
|
|
298
313
|
val spring = SpringAnimation(sheetContainer, DynamicAnimation.TRANSLATION_Y, targetTy).apply {
|
|
@@ -310,6 +325,7 @@ class BottomSheetView(context: Context) : ReactViewGroup(context) {
|
|
|
310
325
|
activeAnimation = null
|
|
311
326
|
updateInteractionState()
|
|
312
327
|
if (emitIndexChange) listener?.onIndexChange(index)
|
|
328
|
+
if (emitSettle) listener?.onSettle(index)
|
|
313
329
|
}
|
|
314
330
|
}
|
|
315
331
|
|
package/android/src/main/java/com/swmansion/reactnativebottomsheet/BottomSheetViewManager.kt
CHANGED
|
@@ -40,6 +40,16 @@ class BottomSheetViewManager :
|
|
|
40
40
|
.receiveEvent(view.id, "topIndexChange", event)
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
override fun onSettle(index: Int) {
|
|
44
|
+
val event = com.facebook.react.bridge.Arguments.createMap().apply {
|
|
45
|
+
putInt("index", index)
|
|
46
|
+
}
|
|
47
|
+
val reactContext = view.context as? ThemedReactContext ?: return
|
|
48
|
+
reactContext
|
|
49
|
+
.getJSModule(com.facebook.react.uimanager.events.RCTEventEmitter::class.java)
|
|
50
|
+
.receiveEvent(view.id, "topSettle", event)
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
override fun onPositionChange(position: Double) {
|
|
44
54
|
val event = com.facebook.react.bridge.Arguments.createMap().apply {
|
|
45
55
|
putDouble("position", position)
|
|
@@ -79,6 +89,7 @@ class BottomSheetViewManager :
|
|
|
79
89
|
override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> {
|
|
80
90
|
return mapOf(
|
|
81
91
|
"topIndexChange" to mapOf("registrationName" to "onIndexChange"),
|
|
92
|
+
"topSettle" to mapOf("registrationName" to "onSettle"),
|
|
82
93
|
"topPositionChange" to mapOf("registrationName" to "onPositionChange"),
|
|
83
94
|
)
|
|
84
95
|
}
|
|
@@ -18,6 +18,7 @@ using namespace facebook::react;
|
|
|
18
18
|
BottomSheetContentView *_sheetView;
|
|
19
19
|
State::Shared _sheetState;
|
|
20
20
|
float _lastContentOffsetY;
|
|
21
|
+
BOOL _needsIndexSyncAfterRecycle;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
@@ -30,6 +31,7 @@ using namespace facebook::react;
|
|
|
30
31
|
if (self = [super initWithFrame:frame]) {
|
|
31
32
|
static const auto defaultProps = std::make_shared<const BottomSheetViewProps>();
|
|
32
33
|
_props = defaultProps;
|
|
34
|
+
_needsIndexSyncAfterRecycle = NO;
|
|
33
35
|
|
|
34
36
|
_sheetView = [[BottomSheetContentView alloc] initWithFrame:CGRectZero];
|
|
35
37
|
_sheetView.delegate = self;
|
|
@@ -56,8 +58,9 @@ using namespace facebook::react;
|
|
|
56
58
|
[_sheetView setDetents:detentsArray];
|
|
57
59
|
}
|
|
58
60
|
|
|
59
|
-
if (newViewProps.index != oldViewProps.index) {
|
|
61
|
+
if (_needsIndexSyncAfterRecycle || newViewProps.index != oldViewProps.index) {
|
|
60
62
|
[_sheetView setDetentIndex:newViewProps.index];
|
|
63
|
+
_needsIndexSyncAfterRecycle = NO;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
if (newViewProps.animateIn != oldViewProps.animateIn) {
|
|
@@ -100,6 +103,14 @@ using namespace facebook::react;
|
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
|
|
106
|
+
- (void)bottomSheetView:(BottomSheetContentView *)view didSettle:(NSInteger)index
|
|
107
|
+
{
|
|
108
|
+
if (_eventEmitter) {
|
|
109
|
+
auto emitter = std::static_pointer_cast<const BottomSheetViewEventEmitter>(_eventEmitter);
|
|
110
|
+
emitter->onSettle({.index = static_cast<int>(index)});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
103
114
|
- (void)bottomSheetView:(BottomSheetContentView *)view didChangePosition:(CGFloat)position
|
|
104
115
|
{
|
|
105
116
|
if (_eventEmitter) {
|
|
@@ -121,6 +132,7 @@ using namespace facebook::react;
|
|
|
121
132
|
- (void)prepareForRecycle
|
|
122
133
|
{
|
|
123
134
|
[super prepareForRecycle];
|
|
135
|
+
_needsIndexSyncAfterRecycle = YES;
|
|
124
136
|
[_sheetView resetSheetState];
|
|
125
137
|
_sheetState.reset();
|
|
126
138
|
_lastContentOffsetY = 0;
|
|
@@ -6,6 +6,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
6
6
|
|
|
7
7
|
@protocol BottomSheetContentViewDelegate <NSObject>
|
|
8
8
|
- (void)bottomSheetView:(BottomSheetContentView *)view didChangeIndex:(NSInteger)index;
|
|
9
|
+
- (void)bottomSheetView:(BottomSheetContentView *)view didSettle:(NSInteger)index;
|
|
9
10
|
- (void)bottomSheetView:(BottomSheetContentView *)view didChangePosition:(CGFloat)position;
|
|
10
11
|
@end
|
|
11
12
|
|
|
@@ -90,6 +90,11 @@
|
|
|
90
90
|
[self.delegate bottomSheetView:self didChangeIndex:index];
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
- (void)bottomSheetHostingView:(RNSBottomSheetHostingView *)view didSettle:(NSInteger)index
|
|
94
|
+
{
|
|
95
|
+
[self.delegate bottomSheetView:self didSettle:index];
|
|
96
|
+
}
|
|
97
|
+
|
|
93
98
|
- (void)bottomSheetHostingView:(RNSBottomSheetHostingView *)view didChangePosition:(CGFloat)position
|
|
94
99
|
{
|
|
95
100
|
[self.delegate bottomSheetView:self didChangePosition:position];
|
|
@@ -2,6 +2,7 @@ import UIKit
|
|
|
2
2
|
|
|
3
3
|
@objc public protocol RNSBottomSheetHostingViewDelegate: AnyObject {
|
|
4
4
|
func bottomSheetHostingView(_ view: RNSBottomSheetHostingView, didChangeIndex index: Int)
|
|
5
|
+
func bottomSheetHostingView(_ view: RNSBottomSheetHostingView, didSettle index: Int)
|
|
5
6
|
func bottomSheetHostingView(_ view: RNSBottomSheetHostingView, didChangePosition position: CGFloat)
|
|
6
7
|
}
|
|
7
8
|
|
|
@@ -112,7 +113,7 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
112
113
|
let closedTy = detentSpecs.last?.height ?? bounds.height
|
|
113
114
|
sheetContainer.transform = CGAffineTransform(translationX: 0, y: closedTy)
|
|
114
115
|
emitPosition()
|
|
115
|
-
snapToIndex(targetIndex, velocity: 0, emitIndexChange: false)
|
|
116
|
+
snapToIndex(targetIndex, velocity: 0, emitIndexChange: false, emitSettle: false)
|
|
116
117
|
} else {
|
|
117
118
|
sheetContainer.transform = CGAffineTransform(translationX: 0, y: translationY(for: targetIndex))
|
|
118
119
|
emitPosition()
|
|
@@ -161,6 +162,30 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
161
162
|
let programmatic = (dict["programmatic"] as? Bool) ?? (dict["programmatic"] as? NSNumber)?.boolValue ?? false
|
|
162
163
|
return DetentSpec(height: CGFloat(height), programmatic: programmatic)
|
|
163
164
|
}
|
|
165
|
+
guard bounds.width > 0, bounds.height > 0, !detentSpecs.isEmpty else {
|
|
166
|
+
return
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if hasLaidOut && !isPanning {
|
|
170
|
+
targetIndex = max(0, min(detentSpecs.count - 1, targetIndex))
|
|
171
|
+
layoutIfNeeded()
|
|
172
|
+
|
|
173
|
+
if let animator = activeAnimator {
|
|
174
|
+
stopDisplayLink()
|
|
175
|
+
let visualTy = sheetContainer.layer.presentation()?.affineTransform().ty ?? sheetContainer.transform.ty
|
|
176
|
+
animator.stopAnimation(true)
|
|
177
|
+
activeAnimator = nil
|
|
178
|
+
sheetContainer.transform = CGAffineTransform(
|
|
179
|
+
translationX: 0,
|
|
180
|
+
y: min(max(visualTy, 0), detentSpecs.last?.height ?? visualTy)
|
|
181
|
+
)
|
|
182
|
+
emitPosition()
|
|
183
|
+
snapToIndex(targetIndex, velocity: 0, emitIndexChange: false, emitSettle: false)
|
|
184
|
+
} else {
|
|
185
|
+
sheetContainer.transform = CGAffineTransform(translationX: 0, y: translationY(for: targetIndex))
|
|
186
|
+
emitPosition()
|
|
187
|
+
}
|
|
188
|
+
}
|
|
164
189
|
}
|
|
165
190
|
|
|
166
191
|
public func setDetentIndex(_ newIndex: Int) {
|
|
@@ -296,7 +321,12 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
296
321
|
snapToIndex(closedIndex, velocity: 0)
|
|
297
322
|
}
|
|
298
323
|
|
|
299
|
-
private func snapToIndex(
|
|
324
|
+
private func snapToIndex(
|
|
325
|
+
_ index: Int,
|
|
326
|
+
velocity: CGFloat,
|
|
327
|
+
emitIndexChange: Bool = true,
|
|
328
|
+
emitSettle: Bool = true
|
|
329
|
+
) {
|
|
300
330
|
guard index >= 0, index < detentSpecs.count else { return }
|
|
301
331
|
targetIndex = index
|
|
302
332
|
|
|
@@ -325,6 +355,9 @@ public final class RNSBottomSheetHostingView: UIView {
|
|
|
325
355
|
if emitIndexChange {
|
|
326
356
|
self.eventDelegate?.bottomSheetHostingView(self, didChangeIndex: index)
|
|
327
357
|
}
|
|
358
|
+
if emitSettle {
|
|
359
|
+
self.eventDelegate?.bottomSheetHostingView(self, didSettle: index)
|
|
360
|
+
}
|
|
328
361
|
}
|
|
329
362
|
animator.startAnimation()
|
|
330
363
|
activeAnimator = animator
|
|
@@ -15,6 +15,7 @@ export const BottomSheet = ({
|
|
|
15
15
|
index,
|
|
16
16
|
animateIn = true,
|
|
17
17
|
onIndexChange,
|
|
18
|
+
onSettle,
|
|
18
19
|
onPositionChange,
|
|
19
20
|
modal = false,
|
|
20
21
|
scrimColor = 'rgba(0, 0, 0, 0.5)'
|
|
@@ -41,6 +42,9 @@ export const BottomSheet = ({
|
|
|
41
42
|
const handleIndexChange = event => {
|
|
42
43
|
onIndexChange?.(event.nativeEvent.index);
|
|
43
44
|
};
|
|
45
|
+
const handleSettle = event => {
|
|
46
|
+
onSettle?.(event.nativeEvent.index);
|
|
47
|
+
};
|
|
44
48
|
const handlePositionChange = event => {
|
|
45
49
|
const height = event.nativeEvent.position;
|
|
46
50
|
sheetOpacity.setValue(height === 0 ? 0 : 1);
|
|
@@ -72,6 +76,7 @@ export const BottomSheet = ({
|
|
|
72
76
|
modal: modal,
|
|
73
77
|
scrimColor: scrimColor,
|
|
74
78
|
onIndexChange: handleIndexChange,
|
|
79
|
+
onSettle: handleSettle,
|
|
75
80
|
onPositionChange: handlePositionChange,
|
|
76
81
|
children: /*#__PURE__*/_jsxs(View, {
|
|
77
82
|
collapsable: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","useState","Animated","StyleSheet","View","useWindowDimensions","useSafeAreaInsets","BottomSheetNativeComponent","Portal","resolveDetent","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","children","style","detents","index","animateIn","onIndexChange","onPositionChange","modal","scrimColor","height","windowHeight","insets","maxHeight","top","contentHeight","setContentHeight","sheetOpacity","Value","current","resolvedDetents","map","detent","value","Math","max","min","isDetentProgrammatic","handleSentinelLayout","event","nativeEvent","layout","y","clampedIndex","length","isCollapsed","handleIndexChange","handlePositionChange","position","setValue","sheet","absoluteFill","pointerEvents","opacity","left","right","bottom","collapsable","flex","onLayout"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,QAAQ,QAAwB,OAAO;AAExD,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,EAAEC,mBAAmB,QAAQ,cAAc;AAC9E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,SAASC,MAAM,QAAQ,0BAAuB;AAC9C,SAAsBC,aAAa,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhE,SAASC,YAAY,QAAQ,uBAAoB;
|
|
1
|
+
{"version":3,"names":["useRef","useState","Animated","StyleSheet","View","useWindowDimensions","useSafeAreaInsets","BottomSheetNativeComponent","Portal","resolveDetent","jsx","_jsx","jsxs","_jsxs","programmatic","BottomSheet","children","style","detents","index","animateIn","onIndexChange","onSettle","onPositionChange","modal","scrimColor","height","windowHeight","insets","maxHeight","top","contentHeight","setContentHeight","sheetOpacity","Value","current","resolvedDetents","map","detent","value","Math","max","min","isDetentProgrammatic","handleSentinelLayout","event","nativeEvent","layout","y","clampedIndex","length","isCollapsed","handleIndexChange","handleSettle","handlePositionChange","position","setValue","sheet","absoluteFill","pointerEvents","opacity","left","right","bottom","collapsable","flex","onLayout"],"sourceRoot":"../../src","sources":["BottomSheet.tsx"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,QAAQ,QAAwB,OAAO;AAExD,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,EAAEC,mBAAmB,QAAQ,cAAc;AAC9E,SAASC,iBAAiB,QAAQ,gCAAgC;AAElE,OAAOC,0BAA0B,MAAM,8BAA8B;AACrE,SAASC,MAAM,QAAQ,0BAAuB;AAC9C,SAAsBC,aAAa,QAAQ,uBAAoB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEhE,SAASC,YAAY,QAAQ,uBAAoB;AAejD,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,QAAQ;EACRC,KAAK;EACLC,OAAO,GAAG,CAAC,CAAC,EAAE,SAAS,CAAC;EACxBC,KAAK;EACLC,SAAS,GAAG,IAAI;EAChBC,aAAa;EACbC,QAAQ;EACRC,gBAAgB;EAChBC,KAAK,GAAG,KAAK;EACbC,UAAU,GAAG;AACG,CAAC,KAAK;EACtB,MAAM;IAAEC,MAAM,EAAEC;EAAa,CAAC,GAAGtB,mBAAmB,CAAC,CAAC;EACtD,MAAMuB,MAAM,GAAGtB,iBAAiB,CAAC,CAAC;EAClC,MAAMuB,SAAS,GAAGF,YAAY,GAAGC,MAAM,CAACE,GAAG;EAC3C,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAG/B,QAAQ,CAAC,CAAC,CAAC;EACrD,MAAMgC,YAAY,GA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,QAAA,EAAEyC;IAAK,CAAS,CAAC;EACjC;EAEA,OAAOA,KAAK;AACd,CAAC;AAED,SAASd,oBAAoBA,CAACL,MAAc,EAAW;EACrD,IAAI,OAAOA,MAAM,KAAK,QAAQ,IAAIA,MAAM,KAAK,IAAI,EAAE;IACjD,OAAOA,MAAM,CAACxB,YAAY,KAAK,IAAI;EACrC;EACA,OAAO,KAAK;AACd","ignoreList":[]}
|
|
@@ -19,6 +19,9 @@ export interface NativeProps extends ViewProps {
|
|
|
19
19
|
onIndexChange?: CodegenTypes.DirectEventHandler<
|
|
20
20
|
Readonly<{ index: CodegenTypes.Int32 }>
|
|
21
21
|
>;
|
|
22
|
+
onSettle?: CodegenTypes.DirectEventHandler<
|
|
23
|
+
Readonly<{ index: CodegenTypes.Int32 }>
|
|
24
|
+
>;
|
|
22
25
|
onPositionChange?: CodegenTypes.DirectEventHandler<
|
|
23
26
|
Readonly<{ position: CodegenTypes.Double }>
|
|
24
27
|
>;
|
|
@@ -10,9 +10,10 @@ export interface BottomSheetProps {
|
|
|
10
10
|
index: number;
|
|
11
11
|
animateIn?: boolean;
|
|
12
12
|
onIndexChange?: (index: number) => void;
|
|
13
|
+
onSettle?: (index: number) => void;
|
|
13
14
|
onPositionChange?: (position: number) => void;
|
|
14
15
|
modal?: boolean;
|
|
15
16
|
scrimColor?: string;
|
|
16
17
|
}
|
|
17
|
-
export declare const BottomSheet: ({ children, style, detents, index, animateIn, onIndexChange, onPositionChange, modal, scrimColor, }: BottomSheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare const BottomSheet: ({ children, style, detents, index, animateIn, onIndexChange, onSettle, onPositionChange, modal, scrimColor, }: BottomSheetProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
//# sourceMappingURL=BottomSheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/BottomSheet.tsx"],"names":[],"mappings":"AAAA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AAC,SAAS,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,WAAW,GAAI,+GAWzB,gBAAgB,4CAmFlB,CAAC"}
|
|
@@ -12,6 +12,9 @@ export interface NativeProps extends ViewProps {
|
|
|
12
12
|
onIndexChange?: CodegenTypes.DirectEventHandler<Readonly<{
|
|
13
13
|
index: CodegenTypes.Int32;
|
|
14
14
|
}>>;
|
|
15
|
+
onSettle?: CodegenTypes.DirectEventHandler<Readonly<{
|
|
16
|
+
index: CodegenTypes.Int32;
|
|
17
|
+
}>>;
|
|
15
18
|
onPositionChange?: CodegenTypes.DirectEventHandler<Readonly<{
|
|
16
19
|
position: CodegenTypes.Double;
|
|
17
20
|
}>>;
|
|
@@ -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,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC;IAC5B,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,WAAW,WAAY,SAAQ,SAAS;IAC5C,OAAO,EAAE,aAAa,CAAC,YAAY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IACF,gBAAgB,CAAC,EAAE,YAAY,CAAC,kBAAkB,CAChD,QAAQ,CAAC;QAAE,QAAQ,EAAE,YAAY,CAAC,MAAM,CAAA;KAAE,CAAC,CAC5C,CAAC;CACH;;AAED,wBAAsE"}
|
package/package.json
CHANGED
package/src/BottomSheet.tsx
CHANGED
|
@@ -16,6 +16,7 @@ export interface BottomSheetProps {
|
|
|
16
16
|
index: number;
|
|
17
17
|
animateIn?: boolean;
|
|
18
18
|
onIndexChange?: (index: number) => void;
|
|
19
|
+
onSettle?: (index: number) => void;
|
|
19
20
|
onPositionChange?: (position: number) => void;
|
|
20
21
|
modal?: boolean;
|
|
21
22
|
scrimColor?: string;
|
|
@@ -28,6 +29,7 @@ export const BottomSheet = ({
|
|
|
28
29
|
index,
|
|
29
30
|
animateIn = true,
|
|
30
31
|
onIndexChange,
|
|
32
|
+
onSettle,
|
|
31
33
|
onPositionChange,
|
|
32
34
|
modal = false,
|
|
33
35
|
scrimColor = 'rgba(0, 0, 0, 0.5)',
|
|
@@ -55,6 +57,9 @@ export const BottomSheet = ({
|
|
|
55
57
|
const handleIndexChange = (event: { nativeEvent: { index: number } }) => {
|
|
56
58
|
onIndexChange?.(event.nativeEvent.index);
|
|
57
59
|
};
|
|
60
|
+
const handleSettle = (event: { nativeEvent: { index: number } }) => {
|
|
61
|
+
onSettle?.(event.nativeEvent.index);
|
|
62
|
+
};
|
|
58
63
|
|
|
59
64
|
const handlePositionChange = (event: {
|
|
60
65
|
nativeEvent: { position: number };
|
|
@@ -94,6 +99,7 @@ export const BottomSheet = ({
|
|
|
94
99
|
modal={modal}
|
|
95
100
|
scrimColor={scrimColor}
|
|
96
101
|
onIndexChange={handleIndexChange}
|
|
102
|
+
onSettle={handleSettle}
|
|
97
103
|
onPositionChange={handlePositionChange}
|
|
98
104
|
>
|
|
99
105
|
<View collapsable={false} style={{ flex: 1, maxHeight }}>
|
|
@@ -19,6 +19,9 @@ export interface NativeProps extends ViewProps {
|
|
|
19
19
|
onIndexChange?: CodegenTypes.DirectEventHandler<
|
|
20
20
|
Readonly<{ index: CodegenTypes.Int32 }>
|
|
21
21
|
>;
|
|
22
|
+
onSettle?: CodegenTypes.DirectEventHandler<
|
|
23
|
+
Readonly<{ index: CodegenTypes.Int32 }>
|
|
24
|
+
>;
|
|
22
25
|
onPositionChange?: CodegenTypes.DirectEventHandler<
|
|
23
26
|
Readonly<{ position: CodegenTypes.Double }>
|
|
24
27
|
>;
|